package SQL::Translator::Parser::Access;
# -------------------------------------------------------------------
-# $Id: Access.pm,v 1.2 2004-07-30 21:56:18 kycl4rk Exp $
+# $Id: Access.pm,v 1.3 2005-06-28 16:39:41 mwz444 Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use strict;
use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 0 unless defined $DEBUG;
use Data::Dumper;
}
}
-reference_definition : /references/i table_name parens_field_list(?) match_type(?) on_delete_do(?) on_update_do(?)
+reference_definition : /references/i table_name parens_field_list(?) match_type(?) on_delete(?) on_update(?)
{
$return = {
type => 'foreign_key',
reference_table => $item[2],
reference_fields => $item[3][0],
match_type => $item[4][0],
- on_delete_do => $item[5][0],
- on_update_do => $item[6][0],
+ on_delete => $item[5][0],
+ on_update => $item[6][0],
}
}
|
/match partial/i { 'partial' }
-on_delete_do : /on delete/i reference_option
+on_delete : /on delete/i reference_option
{ $item[2] }
-on_update_do : /on update/i reference_option
+on_update : /on update/i reference_option
{ $item[2] }
reference_option: /restrict/i |
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;
}
}
package SQL::Translator::Parser::MySQL;
# -------------------------------------------------------------------
-# $Id: MySQL.pm,v 1.49 2005-06-27 20:36:42 duality72 Exp $
+# $Id: MySQL.pm,v 1.50 2005-06-28 16:39:41 mwz444 Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use strict;
use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.49 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.50 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 0 unless defined $DEBUG;
use Data::Dumper;
blank : /\s*/
-field : field_comment(s?) field_name data_type field_qualifier(s?) field_comment2(?) reference_definition(?) on_update_do(?) field_comment(s?)
+field : field_comment(s?) field_name data_type field_qualifier(s?) field_comment2(?) reference_definition(?) on_update(?) field_comment(s?)
{
my %qualifiers = map { %$_ } @{ $item{'field_qualifier(s?)'} || [] };
if ( my @type_quals = @{ $item{'data_type'}{'qualifiers'} || [] } ) {
}
}
-reference_definition : /references/i table_name parens_field_list(?) match_type(?) on_delete_do(?) on_update_do(?)
+reference_definition : /references/i table_name parens_field_list(?) match_type(?) on_delete(?) on_update(?)
{
$return = {
type => 'foreign_key',
reference_table => $item[2],
reference_fields => $item[3][0],
match_type => $item[4][0],
- on_delete_do => $item[5][0],
- on_update_do => $item[6][0],
+ on_delete => $item[5][0],
+ on_update => $item[6][0],
}
}
|
/match partial/i { 'partial' }
-on_delete_do : /on delete/i reference_option
+on_delete : /on delete/i reference_option
{ $item[2] }
-on_update_do :
+on_update :
/on update/i 'CURRENT_TIMESTAMP'
{ $item[2] }
|
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;
}
}
package SQL::Translator::Parser::Oracle;
# -------------------------------------------------------------------
-# $Id: Oracle.pm,v 1.19 2004-09-17 21:52:46 kycl4rk Exp $
+# $Id: Oracle.pm,v 1.20 2005-06-28 16:39:41 mwz444 Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use strict;
use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.19 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.20 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 0 unless defined $DEBUG;
use Data::Dumper;
reference_table => $desc->{'reference_table'},
reference_fields => $desc->{'reference_fields'},
# match_type => $desc->{'match_type'},
-# on_update_do => $desc->{'on_update_do'},
+# on_update => $desc->{'on_update'},
}
}
{ $return = { type => 'primary_key' } }
| /check/i '(' /[^)]+/ ')'
{ $return = { type => 'check', expression => $item[3] } }
- | /references/i table_name parens_word_list(?) on_delete_do(?)
+ | /references/i table_name parens_word_list(?) on_delete(?)
{
$return = {
type => 'foreign_key',
reference_table => $item[2],
reference_fields => $item[3][0],
# match_type => $item[4][0],
- on_delete_do => $item[5][0],
+ on_delete => $item[5][0],
}
}
reference_table => $desc->{'reference_table'},
reference_fields => $desc->{'reference_fields'},
# match_type => $desc->{'match_type'}[0],
- on_delete_do => $desc->{'on_delete_do'},
- on_update_do => $desc->{'on_update_do'},
+ on_delete => $desc->{'on_delete'} || $desc->{'on_delete_do'},
+ on_update => $desc->{'on_update'} || $desc->{'on_update_do'},
comments => [ @comments ],
}
}
}
}
|
- /foreign key/i '(' NAME(s /,/) ')' /references/i table_name parens_word_list(?) on_delete_do(?)
+ /foreign key/i '(' NAME(s /,/) ')' /references/i table_name parens_word_list(?) on_delete(?)
{
$return = {
type => 'foreign_key',
reference_table => $item[6],
reference_fields => $item[7][0],
match_type => $item[8][0],
- on_delete_do => $item[9][0],
- on_update_do => $item[10][0],
+ on_delete => $item[9][0],
+ on_update => $item[10][0],
}
}
-on_delete_do : /on delete/i WORD(s)
+on_delete : /on delete/i WORD(s)
{ $item[2] }
UNIQUE : /unique/i { $return = 1 }
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;
}
}
package SQL::Translator::Parser::PostgreSQL;
# -------------------------------------------------------------------
-# $Id: PostgreSQL.pm,v 1.43 2004-10-23 20:18:44 cmungall Exp $
+# $Id: PostgreSQL.pm,v 1.44 2005-06-28 16:39:41 mwz444 Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use strict;
use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.43 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.44 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 0 unless defined $DEBUG;
use Data::Dumper;
reference_table => $desc->{'reference_table'},
reference_fields => $desc->{'reference_fields'},
match_type => $desc->{'match_type'},
- on_delete_do => $desc->{'on_delete_do'},
- on_update_do => $desc->{'on_update_do'},
+ on_delete => $desc->{'on_delete'} || $desc->{'on_delete_do'},
+ on_update => $desc->{'on_update'} || $desc->{'on_update_do'},
}
}
reference_table => $item[2],
reference_fields => $item[3][0],
match_type => $item[4][0],
- on_delete_do => $on_delete,
- on_update_do => $on_update,
+ on_delete => $on_delete,
+ on_update => $on_update,
}
}
reference_table => $desc->{'reference_table'},
reference_fields => $desc->{'reference_fields'},
match_type => $desc->{'match_type'}[0],
- on_delete_do => $desc->{'on_delete_do'},
- on_update_do => $desc->{'on_update_do'},
+ on_delete => $desc->{'on_delete'} || $desc->{'on_delete_do'},
+ on_update => $desc->{'on_update'} || $desc->{'on_update_do'},
comments => [ @comments ],
}
}
reference_table => $item[6],
reference_fields => $item[7][0],
match_type => $item[8][0],
- on_delete_do => $on_delete || '',
- on_update_do => $on_update || '',
+ on_delete => $on_delete || '',
+ on_update => $on_update || '',
}
}
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'},
expression => $cdata->{'expression'},
) or die "Can't add constraint of type '" .
$cdata->{'type'} . "' to table '" . $table->name .
package SQL::Translator::Parser::SQLServer;
# -------------------------------------------------------------------
-# $Id: SQLServer.pm,v 1.1 2005-06-27 19:01:31 duality72 Exp $
+# $Id: SQLServer.pm,v 1.2 2005-06-28 16:39:41 mwz444 Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use strict;
use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 0 unless defined $DEBUG;
use Data::Dumper;
}
}
-foreign_key_constraint : /constraint/i index_name(?) /foreign/i /key/i parens_field_list /references/i table_name parens_field_list(?) on_delete_do(?) on_update_do(?)
+foreign_key_constraint : /constraint/i index_name(?) /foreign/i /key/i parens_field_list /references/i table_name parens_field_list(?) on_delete(?) on_update(?)
{
$return = {
supertype => 'constraint',
fields => $item[5],
reference_table => $item[7],
reference_fields => $item[8][0],
- on_delete_do => $item[9][0],
- on_update_do => $item[10][0],
+ on_delete => $item[9][0],
+ on_update => $item[10][0],
}
}
}
}
-on_delete_do : /on delete/i reference_option
+on_delete : /on delete/i reference_option
{ $item[2] }
-on_update_do : /on update/i reference_option
+on_update : /on update/i reference_option
{ $item[2] }
reference_option: /cascade/i |
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;
}
}
package SQL::Translator::Parser::SQLite;
# -------------------------------------------------------------------
-# $Id: SQLite.pm,v 1.6 2004-02-09 22:23:40 kycl4rk Exp $
+# $Id: SQLite.pm,v 1.7 2005-06-28 16:39:41 mwz444 Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use strict;
use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 0 unless defined $DEBUG;
use Data::Dumper;
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;
}
}
package SQL::Translator::Parser::Sybase;
# -------------------------------------------------------------------
-# $Id: Sybase.pm,v 1.9 2004-02-09 22:23:40 kycl4rk Exp $
+# $Id: Sybase.pm,v 1.10 2005-06-28 16:39:41 mwz444 Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use strict;
use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 0 unless defined $DEBUG;
use Data::Dumper;
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;
}
}
package SQL::Translator::Parser::XML::SQLFairy;
# -------------------------------------------------------------------
-# $Id: SQLFairy.pm,v 1.13 2004-12-21 01:29:23 grommit Exp $
+# $Id: SQLFairy.pm,v 1.14 2005-06-28 16:39:41 mwz444 Exp $
# -------------------------------------------------------------------
# Copyright (C) 2003 Mark Addison <mark.addison@itn.co.uk>,
#
use strict;
use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.13 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.14 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 0 unless defined $DEBUG;
use Data::Dumper;
foreach (@nodes) {
my %data = get_tagfields($xp, $_, "sqlf:",
qw/name type table fields reference_fields reference_table
- match_type on_delete_do on_update_do extra/
+ match_type on_delete on_update extra/
);
$table->add_constraint( %data ) or die $table->error;
}
" match_type is '$test->{match_type}'" )
if exists $test->{match_type};
- is( $con->on_delete_do, $test->{on_delete_do},
- " on_delete_do is '$test->{on_delete_do}'" )
- if exists $test->{on_delete_do};
+ is( $con->on_delete, $test->{on_delete},
+ " on_delete is '$test->{on_delete}'" )
+ if exists $test->{on_delete};
- is( $con->on_update_do, $test->{on_update_do},
- " on_update_do is '$test->{on_update_do}'" )
- if exists $test->{on_update_do};
+ is( $con->on_update, $test->{on_update},
+ " on_update is '$test->{on_update}'" )
+ if exists $test->{on_update};
}
sub test_table {