[Jifty-commit] r2676 - in Jifty-DBI/branches/od: .
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Sun Jan 28 07:29:20 EST 2007
Author: jesse
Date: Sun Jan 28 07:29:18 2007
New Revision: 2676
Modified:
Jifty-DBI/branches/od/ (props changed)
Jifty-DBI/branches/od/lib/Jifty/DBI/SchemaGenerator.pm
Log:
r21598 at hualien (orig r2675): jesse | 2007-01-28 20:28:18 +0800
r21597 at hualien: jesse | 2007-01-28 20:26:43 +0800
added a method to the schema generator to get at column_definition_sql
Modified: Jifty-DBI/branches/od/lib/Jifty/DBI/SchemaGenerator.pm
==============================================================================
--- Jifty-DBI/branches/od/lib/Jifty/DBI/SchemaGenerator.pm (original)
+++ Jifty-DBI/branches/od/lib/Jifty/DBI/SchemaGenerator.pm Sun Jan 28 07:29:18 2007
@@ -156,7 +156,7 @@
class/subclass; in the latter case, C<add_model> will instantiate an
object of the class.
-The model must define the instance methods C<Schema> and C<Table>.
+The model must define the instance methods C<schema> and C<table>.
Returns true if the model was added successfully; returns a false
C<Class::ReturnValue> error otherwise.
@@ -190,7 +190,22 @@
$self->_db_schema->addtable($table_obj);
- 1;
+ return 1;
+}
+
+=head2 column_definition_sql TABLENAME COLUMNNAME
+
+Given a tablename and a column name, returns the SQL fragment
+describing that column for the current database.
+
+=cut
+
+sub column_definition_sql {
+ my $self = shift;
+ my $table = shift;
+ my $col = shift;
+ my $table_obj = $self->_db_schema->table($table);
+ return $table_obj->column( $col )->line( $self->handle->dbh )
}
=head2 create_table_sql_statements
@@ -211,6 +226,7 @@
Returns a string containing a sequence of SQL statements to create tables for all of
the models added to the SchemaGenerator.
+This is just a trivial wrapper around L</create_Table_sql_statements>.
=cut
More information about the Jifty-commit
mailing list