package SQL::Translator::Parser::SQLite;
# -------------------------------------------------------------------
-# $Id: SQLite.pm,v 1.5 2004-02-04 17:32:42 dlc Exp $
+# $Id: SQLite.pm,v 1.9 2006-06-08 21:02:19 schiffbruechige Exp $
# -------------------------------------------------------------------
-# Copyright (C) 2003 Ken Y. Clark <kclark@cpan.org>,
-# darren chamberlain <darren@cpan.org>,
-# Chris Mungall <cjm@fruitfly.org>
+# Copyright (C) 2002-4 SQLFairy Authors
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
use strict;
use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 0 unless defined $DEBUG;
use Data::Dumper;
statement : begin_transaction
| commit
+ | drop
| comment
| create
| <error>
commit : /commit/i SEMICOLON
+drop : /drop/i TABLE <commit> table_name SEMICOLON
+
comment : /^\s*(?:#|-{2}).*\n/
{
my $comment = $item[1];
instead_of => 0,
db_event => $item[6],
action => $item[9],
+ on_table => $table_name,
}
}
instead_of => 1,
db_event => $item[6],
action => $item[9],
+ on_table => $table_name,
}
}
}
| /NULL/
{ 'NULL' }
+ | /CURRENT_TIMESTAMP/i
+ { 'CURRENT_TIMESTAMP' }
!;
reference_table => $cdata->{'reference_table'},
reference_fields => $cdata->{'reference_fields'},
match_type => $cdata->{'match_type'} || '',
- on_delete => $cdata->{'on_delete_do'},
- on_update => $cdata->{'on_update_do'},
+ on_delete => $cdata->{'on_delete'} || $cdata->{'on_delete_do'},
+ on_update => $cdata->{'on_update'} || $cdata->{'on_update_do'},
) or die $table->error;
}
}
perform_action_when => $def->{'when'},
database_event => $def->{'db_event'},
action => $def->{'action'},
+ on_table => $def->{'on_table'},
);
}