* Remove dependency on List::MoreUtils ( http://is.gd/lmu_cac_debacle )
* Fix parsing of strings with leading whitespace for MySQL, Oracle, PostgreSQL,
SQLServer and SQLite
+ * Fix parsing of MySQL column comments (RT#83380)
0.11021 2015-01-29
}
-field_comment2 : /comment/i SQSTRING
- { $return = $item[2] }
-
blank : /\s*/
-field : field_comment(s?) field_name data_type field_qualifier(s?) field_comment2(?) reference_definition(?) on_update(?) field_comment(s?)
+field : field_comment(s?) field_name data_type field_qualifier(s?) reference_definition(?) on_update(?) field_comment(s?)
{
my %qualifiers = map { %$_ } @{ $item{'field_qualifier(s?)'} || [] };
if ( my @type_quals = @{ $item{'data_type'}{'qualifiers'} || [] } ) {
? $qualifiers{'not_null'} : 1;
delete $qualifiers{'not_null'};
- my @comments = ( @{ $item[1] }, @{ $item[5] }, @{ $item[8] } );
+ my @comments = ( @{ $item[1] }, (exists $qualifiers{comment} ? delete $qualifiers{comment} : ()) , @{ $item[7] } );
$return = {
supertype => 'field',
}
}
+field_qualifier : /comment/i string
+ {
+ $return = {
+ comment => $item[2],
+ }
+ }
+
reference_definition : /references/i table_name parens_field_list(?) match_type(?) on_delete(?) on_update(?)
{
$return = {
my $data = parse($tr,
q[
CREATE TABLE orders (
- order_id integer NOT NULL auto_increment,
+ order_id integer NOT NULL comment ' ' auto_increment,
member_id varchar(255) comment 'fk to ''member''',
billing_address_id int,
shipping_address_id int,
is( $f1->default_value, undef, 'Default value is undefined' );
is( $f1->is_primary_key, 1, 'Field is PK' );
is( $f1->is_auto_increment, 1, 'Field is auto inc' );
+ is_deeply( [$f1->comments],[' '], 'Field comment OK' );
my $f2 = shift @fields;
is( $f2->name, 'member_id', 'Second field name is "member_id"' );