Test and data for FK in SQLite.
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Parser / Sybase.pm
index 6c30700..9b7814c 100644 (file)
@@ -1,11 +1,7 @@
 package SQL::Translator::Parser::Sybase;
 
 # -------------------------------------------------------------------
-# $Id: Sybase.pm,v 1.7 2003-10-15 18:35:09 kycl4rk Exp $
-# -------------------------------------------------------------------
-# Copyright (C) 2003 Ken Y. Clark <kclark@cpan.org>,
-#                    darren chamberlain <darren@cpan.org>,
-#                    Chris Mungall <cjm@fruitfly.org>
+# Copyright (C) 2002-2009 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
@@ -42,7 +38,7 @@ DBI-Sybase parser included with SQL::Translator.
 use strict;
 
 use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/;
+$VERSION = '1.59';
 $DEBUG   = 0 unless defined $DEBUG;
 
 use Data::Dumper;
@@ -59,7 +55,7 @@ $::RD_HINT   = 1;
 $GRAMMAR = q{
 
 { 
-    my ( %tables, @table_comments );
+    my ( %tables, @table_comments, $table_order );
 }
 
 startrule : statement(s) eofile { \%tables }
@@ -133,6 +129,7 @@ create_table : /create/i /table/i ident '(' create_def(s /,/) ')' lock(?) on_sys
             @table_comments = ();
         }
 
+        $tables{ $table_name }{'order'}  = ++$table_order;
         $tables{ $table_name }{'name'}   = $table_name;
         $tables{ $table_name }{'owner'}  = $table_owner;
         $tables{ $table_name }{'system'} = $item[7];
@@ -399,8 +396,8 @@ sub parse {
                 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;
         }
     }