From 4dd69dc7bd6f476624d53d8782c60f9e8cfed63a Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 16 Feb 2006 21:55:17 +0000 Subject: [PATCH] 0.29! --- Changes | 6 ++++-- DBSchema.pm | 29 +++++++++++++++++++++++++++-- DBSchema/Column.pm | 14 +++++++++++--- TODO | 16 ---------------- debian/changelog | 2 +- debian/files | 2 +- debian/rules | 2 +- 7 files changed, 45 insertions(+), 26 deletions(-) delete mode 100644 TODO diff --git a/Changes b/Changes index 5a9a1e0..2166665 100644 --- a/Changes +++ b/Changes @@ -1,10 +1,12 @@ Revision history for Perl extension DBIx::DBSchema. -0.29 Thu Feb 16 06:12:42 PST 2006 +0.29 Thu Feb 16 13:54:42 PST 2006 - Column::sql_add_column fix when adding primary keys to Pg 7.2.x - workaround for PAUSE parsing of DBIx::DBSchema::DBD::Pg version: move DBD::Pg verison checking after $VERSION declaration, thanks Andreas! - - allow setting an empty default value + - kludge: allow scalar ref default to force quoting off, to add things + like functions and empty values as defaults + - Move TODO file to DBSchema.pm and DBS/Column.pm BUGS sections 0.28 Wed Nov 30 09:46:47 PST 2005 - Initial SQLite support from Jesse Vincent diff --git a/DBSchema.pm b/DBSchema.pm index 6e0167a..aa13d4e 100644 --- a/DBSchema.pm +++ b/DBSchema.pm @@ -323,16 +323,25 @@ sub _tables_from_dbh { =back -=head1 AUTHOR +=head1 AUTHORS Ivan Kohler Charles Shapiro and Mitchell Friedman contributed the start of a Sybase driver. +Daniel Hanks contributed the Oracle driver. + +Jesse Vincent contributed the SQLite driver. + +=head1 CONTRIBUTIONS + +Contributions are welcome! I'm especially keen on any interest in the first +three items/projects below under BUGS. + =head1 COPYRIGHT -Copyright (c) 2000-2005 Ivan Kohler +Copyright (c) 2000-2006 Ivan Kohler Copyright (c) 2000 Mail Abuse Prevention System LLC All rights reserved. This program is free software; you can redistribute it and/or modify it under @@ -340,6 +349,18 @@ the same terms as Perl itself. =head1 BUGS +Indices are not stored by name. Index representation could use an overhaul. + +Multiple primary keys are not yet supported. + +Foreign keys and other constraints are not yet supported. + +Eventually it would be nice to have additional transformations (deleted, +modified columns, added/modified/indices (probably need em named first), +added/deleted tables + +Need to port and test with additional databases + Each DBIx::DBSchema object should have a name which corresponds to its name within the SQL database engine (DBI data source). @@ -348,6 +369,10 @@ pretty_print is actually pretty ugly. Perhaps pretty_read should eval column types so that we can use DBI qw(:sql_types) here instead of externally. +sql CREATE TABLE output should convert integers +(i.e. use DBI qw(:sql_types);) to local types using DBI->type_info plus a hash +to fudge things + =head1 SEE ALSO L, L, diff --git a/DBSchema/Column.pm b/DBSchema/Column.pm index 38afbf1..0971f01 100644 --- a/DBSchema/Column.pm +++ b/DBSchema/Column.pm @@ -25,7 +25,7 @@ DBIx::DBSchema::Column - Column objects 'type' => 'varchar' 'null' => 'NOT NULL', 'length' => 64, - 'default' => ' + 'default' => '', 'local' => '', } ); @@ -76,6 +76,9 @@ rules for truth, with one exception: `NOT NULL' is false). B is the SQL length of the column. B is the default value of the column. B is reserved for database-specific information. +Note: If you pass a scalar reference as the B rather than a scalar value, it will be dereferenced and quoting will be forced off. This can be used to pass SQL functions such as C<$now()> or explicit empty strings as C<''> as +defaults. + =cut sub new { @@ -261,7 +264,8 @@ sub line { my $null = $self->null; my $default; - if ( defined($self->default) && ref($dbh) + if ( defined($self->default) && !ref($self->default) && $self->default ne '' + && ref($dbh) # false laziness: nicked from FS::Record::_quote && ( $self->default !~ /^\-?\d+(\.\d+)?$/ || $type =~ /(char|binary|blob|text)$/i @@ -269,7 +273,9 @@ sub line { ) { $default = $dbh->quote($self->default); } else { - $default = $self->default; + warn "*** ref pointing to data: ". ${$self->default} + if $ref($self->default); + $default = ref($self->default) ? ${$self->default} : $self->default; } #this should be a callback into the driver @@ -429,6 +435,8 @@ the same terms as Perl itself. =head1 BUGS +Better documentation is needed for sql_add_column + line() and sql_add_column() hav database-specific foo that should be abstracted into the DBIx::DBSchema:DBD:: modules. diff --git a/TODO b/TODO deleted file mode 100644 index c1136fc..0000000 --- a/TODO +++ /dev/null @@ -1,16 +0,0 @@ -named indices (index representation needs an overhaul) - -multiple primary keys (oracle, db2, others?) - -foreign keys and other constraints - -better documentation for Column::sql_add_column - -Additional transformations (deleted, modified columns, added/modified/indices -(probably need em named first), added/deleted tables - -port and test with additional databases - -sql CREATE TABLE output should convert integers -(i.e. use DBI qw(:sql_types);) to local types using DBI->type_info plus a hash -to fudge things diff --git a/debian/changelog b/debian/changelog index e83f334..d5d3929 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ libdbix-dbschema-perl (0.29-1) unstable; urgency=low - * new upstream release (closes: Bug#342490) + * new upstream release -- Ivan Kohler Thu, 16 Feb 2006 06:19:29 -0800 diff --git a/debian/files b/debian/files index 8dfe287..ac0ce4d 100644 --- a/debian/files +++ b/debian/files @@ -1 +1 @@ -libdbix-dbschema-perl_0.27-1_all.deb perl optional +libdbix-dbschema-perl_0.29-1_all.deb perl optional diff --git a/debian/rules b/debian/rules index 8df15d7..62b057b 100755 --- a/debian/rules +++ b/debian/rules @@ -59,7 +59,7 @@ binary-indep: build install # dh_testversion dh_testdir dh_testroot - dh_installdocs README TODO + dh_installdocs README dh_installexamples dh_installmenu # dh_installemacsen -- 2.11.0