$column = new DBIx::DBSchema::Column ( $name, $sql_type, 'NULL' );
$column = new DBIx::DBSchema::Column ( $name, $sql_type, '', $length );
$column = new DBIx::DBSchema::Column ( $name, $sql_type, 'NULL', $length );
+ $column = new DBIx::DBSchema::Column ( $name, $sql_type, 'NULL', $length, $local );
$name = $column->name;
$column->name( 'name' );
=over 4
-=item new [ NAME [ , SQL_TYPE [ , NULL [ , LENGTH ] ] ] ]
+=item new [ NAME [ , SQL_TYPE [ , NULL [ , LENGTH [ , LOCAL ] ] ] ] ]
Creates a new DBIx::DBSchema::Column object. NAME is the name of the column.
SQL_TYPE is the SQL data type. NULL is the nullability of the column (the
empty string is equivalent to `NOT NULL'). LENGTH is the SQL length of the
-column.
+column. LOCAL is reserved for database-specific information.
=cut
sub new {
- my($proto,$name,$type,$null,$length)=@_;
+ my($proto,$name,$type,$null,$length,$local)=@_;
#croak "Illegal name: $name" if grep $name eq $_, @reserved_words;
'type' => $type,
'null' => $null,
'length' => $length,
+ 'local' => $local,
};
bless ($self, $class);
}
}
+=item local [ LOCAL ]
+
+Returns or sets the database-specific field.
+
+=cut
+
+sub local {
+ my($self,$value)=@_;
+ if ( defined($value) ) {
+ $self->{'local'} = $value;
+ } else {
+ $self->{'local'};
+ }
+}
+
=item line [ $datasrc ]
Returns an SQL column definition.
$self->name,
$self->type. ( $self->length ? '('.$self->length.')' : '' ),
$null,
+ ( ( $datasrc =~ /^dbi:mysql:/i )
+ ? $self->local
+ : ''
+ ),
);
}