From: Daniel Ruoso Date: Wed, 23 Apr 2008 14:49:34 +0000 (+0000) Subject: Implemented add_field, only the field is added, nothing more for now. X-Git-Tag: v0.11008~315 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fe9f1470a6bde2fb118b9e539a2fe580bb269c9c;p=dbsrgits%2FSQL-Translator.git Implemented add_field, only the field is added, nothing more for now. --- diff --git a/lib/SQL/Translator/Producer/Oracle.pm b/lib/SQL/Translator/Producer/Oracle.pm index f7083e8..e603124 100644 --- a/lib/SQL/Translator/Producer/Oracle.pm +++ b/lib/SQL/Translator/Producer/Oracle.pm @@ -446,6 +446,21 @@ sub alter_field { return 'ALTER TABLE '.$table_name_ur.' MODIFY ( '.join('', @$field_defs).' )'; } +sub add_field { + my ($new_field, $options) = @_; + + my ($field_create, $field_defs, $trigger_defs, $field_comments) = + create_field($new_field, $options, {}); + + my $table_name = $new_field->table->name; + my $table_name_ur = unreserve( $table_name ); + + my $out = sprintf('ALTER TABLE %s ADD ( %s )', + $table_name_ur, + join('', @$field_defs)); + return $out; +} + sub create_field { my ($field, $options, $field_name_scope) = @_;