From: Ken Youens-Clark Date: Wed, 11 Jun 2003 03:59:49 +0000 (+0000) Subject: Modified all filed to quit returning the data structure, now only return "1" X-Git-Tag: v0.02~33 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f62bd16c3c7e37047c4d55258fee6cb6728013c2;p=dbsrgits%2FSQL-Translator.git Modified all filed to quit returning the data structure, now only return "1" to show success. --- diff --git a/lib/SQL/Translator/Parser/Excel.pm b/lib/SQL/Translator/Parser/Excel.pm index 3796baf..fba2d2b 100644 --- a/lib/SQL/Translator/Parser/Excel.pm +++ b/lib/SQL/Translator/Parser/Excel.pm @@ -71,7 +71,6 @@ sub parse { my $schema = $tr->schema; my $table_no = 0; - my %parsed; my $wb_count = $wb->{'SheetCount'} || 0; for my $num ( 0 .. $wb_count - 1 ) { $table_no++; @@ -81,12 +80,6 @@ sub parse { my @cols = $ws->ColRange; next unless $cols[1] > 0; - $parsed{ $table_name } = { - table_name => $table_name, - type => undef, - indices => [ {} ], - fields => { }, - }; my $table = $schema->add_table( name => $table_name ); for my $col ( $cols[0] .. $cols[1] ) { @@ -94,20 +87,6 @@ sub parse { my $col_name = normalize_name( $cell->{'Val'} ); my $data_type = ET_to_ST( $cell->{'Type'} ); - $parsed{ $table_name }{'fields'}{ $col_name } = { - type => 'field', - order => $col, - name => $col_name, - data_type => $data_type, - size => [ 255 ], - null => 1, - default => '', - is_auto_inc => undef, - - # first field is the primary key - is_primary_key => ($col == 0) ? 1 : undef, - }; - my $field = $table->add_field( name => $col_name, data_type => $data_type, @@ -124,7 +103,7 @@ sub parse { } } - return \%parsed; + return 1; } sub ET_to_ST { diff --git a/lib/SQL/Translator/Parser/MySQL.pm b/lib/SQL/Translator/Parser/MySQL.pm index c6fcd77..a42cf78 100644 --- a/lib/SQL/Translator/Parser/MySQL.pm +++ b/lib/SQL/Translator/Parser/MySQL.pm @@ -1,7 +1,7 @@ package SQL::Translator::Parser::MySQL; # ------------------------------------------------------------------- -# $Id: MySQL.pm,v 1.24 2003-06-06 22:37:25 kycl4rk Exp $ +# $Id: MySQL.pm,v 1.25 2003-06-11 03:59:49 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # darren chamberlain , @@ -123,7 +123,7 @@ Here's the word from the MySQL site use strict; use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.24 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.25 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; @@ -606,7 +606,7 @@ sub parse { } } - return $result; + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/Oracle.pm b/lib/SQL/Translator/Parser/Oracle.pm index e8e4b64..9b98186 100644 --- a/lib/SQL/Translator/Parser/Oracle.pm +++ b/lib/SQL/Translator/Parser/Oracle.pm @@ -1,7 +1,7 @@ package SQL::Translator::Parser::Oracle; # ------------------------------------------------------------------- -# $Id: Oracle.pm,v 1.3 2003-06-09 02:16:02 kycl4rk Exp $ +# $Id: Oracle.pm,v 1.4 2003-06-11 03:59:49 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark # @@ -95,7 +95,7 @@ constrnt_state use strict; use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; @@ -525,7 +525,7 @@ sub parse { } } - return $result; + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/PostgreSQL.pm b/lib/SQL/Translator/Parser/PostgreSQL.pm index 054aaf9..cea34da 100644 --- a/lib/SQL/Translator/Parser/PostgreSQL.pm +++ b/lib/SQL/Translator/Parser/PostgreSQL.pm @@ -1,7 +1,7 @@ package SQL::Translator::Parser::PostgreSQL; # ------------------------------------------------------------------- -# $Id: PostgreSQL.pm,v 1.16 2003-06-09 02:41:31 kycl4rk Exp $ +# $Id: PostgreSQL.pm,v 1.17 2003-06-11 03:59:49 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # Allen Day , @@ -111,7 +111,7 @@ View table: use strict; use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.16 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.17 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; @@ -747,7 +747,7 @@ sub parse { } } - return $result; + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/xSV.pm b/lib/SQL/Translator/Parser/xSV.pm index 0bb80d7..fad98a9 100644 --- a/lib/SQL/Translator/Parser/xSV.pm +++ b/lib/SQL/Translator/Parser/xSV.pm @@ -1,7 +1,7 @@ package SQL::Translator::Parser::xSV; # ------------------------------------------------------------------- -# $Id: xSV.pm,v 1.9 2003-06-06 00:05:44 kycl4rk Exp $ +# $Id: xSV.pm,v 1.10 2003-06-11 03:59:49 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # darren chamberlain @@ -66,7 +66,7 @@ C. use strict; use vars qw($VERSION @EXPORT); -$VERSION = sprintf "%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/; use Exporter; use Text::ParseWords qw(quotewords); @@ -92,17 +92,6 @@ sub parse { $parser->field_filter( sub { $_ = shift; s/^\s+|\s+$//g; $_ } ) unless defined $args->{'trim_fields'} && $args->{'trim_fields'} == 0; - # - # Create skeleton structure, mostly empty. - # - my $parsed = { - table1 => { - type => undef, - indices => [ { } ], - fields => { }, - }, - }; - my $schema = $tr->schema; my $table = $schema->add_table( name => 'table1' ); @@ -113,24 +102,6 @@ sub parse { my @field_names = $parser->field_list; for ( my $i = 0; $i < @field_names; $i++ ) { - $parsed->{'table1'}{'fields'}{ $field_names[$i] } = { - type => 'field', - order => $i, - name => $field_names[$i], - - # Default datatype is "char" - data_type => 'char', - - # default size is 8bits; something more reasonable? - size => [ 255 ], - null => 1, - default => '', - is_auto_inc => undef, - - # field field is the primary key - is_primary_key => ($i == 0) ? 1 : undef, - }; - my $field = $table->add_field( name => $field_names[$i], data_type => 'char', @@ -196,27 +167,13 @@ sub parse { $field_info{ $field }{'char'} ? 'char' : $field_info{ $field }{'float'} ? 'float' : 'integer'; - $parsed->{'table1'}{'fields'}{ $field }{'size'} = - $field_info{ $field }{'size'}; - - $parsed->{'table1'}{'fields'}{ $field }{'data_type'} = $data_type; - my $field = $table->get_field( $field ); $field->size( $size ); $field->data_type( $data_type ); } } - # - # Field 0 is primary key, by default, so add an index - # - for ( $parsed->{'table1'}->{'indices'}->[0] ) { - $_->{'type'} = 'primary_key'; - $_->{'name'} = undef; - $_->{'fields'} = [ $field_names[0] ]; - } - - return $parsed; + return 1; } 1;