[Bast-commits] r9548 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class/Manual lib/DBIx/Class/Storage/DBI lib/DBIx/Class/Storage/DBI/Oracle

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Wed Jun 2 12:14:04 GMT 2010


Author: ribasushi
Date: 2010-06-02 13:14:04 +0100 (Wed, 02 Jun 2010)
New Revision: 9548

Modified:
   DBIx-Class/0.08/trunk/Changes
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Troubleshooting.pod
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Pg.pm
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/SQLite.pm
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/mysql.pm
Log:
Auto-fill rdbms version for sqlt

Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes	2010-06-02 11:41:39 UTC (rev 9547)
+++ DBIx-Class/0.08/trunk/Changes	2010-06-02 12:14:04 UTC (rev 9548)
@@ -29,6 +29,8 @@
           using software limit emulation
         - create_ddl_dir (and derivatives) now attempt to create the given
           $ddl_dir if it does not already exist
+        - deployment_statements now automatically supplies the current RDBMS
+          version to SQLT producer_args for MySQL, Pg, SQLite and Oracle
 
     * Fixes
         - Fix nasty potentially data-eating bug when deleting/updating

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Troubleshooting.pod
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Troubleshooting.pod	2010-06-02 11:41:39 UTC (rev 9547)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Troubleshooting.pod	2010-06-02 12:14:04 UTC (rev 9548)
@@ -158,13 +158,5 @@
 
 The solution is to use the smallest practical value for LongReadLen.
 
-=head2 create_ddl_dir does not produce DDL for MySQL views
-
-L<SQL::Translator> does not create DDL for MySQL views if it doesn't know you
-are using mysql version 5.000001 or higher.  To explicity set this version, add
-C<mysql_version> to the C<producer_args> in the C<%sqlt> options.
-
-  $schema->create_ddl_dir(['MySQL'], '1.0', './sql/', undef, { producer_args => { mysql_version => 5.000058 } })
-
 =cut
 

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2010-06-02 11:41:39 UTC (rev 9547)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2010-06-02 12:14:04 UTC (rev 9548)
@@ -88,10 +88,14 @@
   $sqltargs->{quote_table_names} = $quote_char ? 1 : 0;
   $sqltargs->{quote_field_names} = $quote_char ? 1 : 0;
 
-  my $oracle_version = try { $self->_get_dbh->get_info(18) };
+  if (
+    ! exists $sqltargs->{producer_args}{oracle_version}
+      and
+    my $dver = $self->_server_info->{dbms_version}
+  ) {
+    $sqltargs->{producer_args}{oracle_version} = $dver;
+  }
 
-  $sqltargs->{producer_args}{oracle_version} = $oracle_version;
-
   $self->next::method($schema, $type, $version, $dir, $sqltargs, @rest);
 }
 

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Pg.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Pg.pm	2010-06-02 11:41:39 UTC (rev 9547)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Pg.pm	2010-06-02 12:14:04 UTC (rev 9548)
@@ -205,8 +205,12 @@
 
   $sqltargs ||= {};
 
-  if (my $version = $self->_server_info->{dbms_version}) {
-    $sqltargs->{producer_args}{postgres_version} = $version;
+  if (
+    ! exists $sqltargs->{producer_args}{postgres_version}
+      and
+    my $dver = $self->_server_info->{normalized_dbms_version}
+  ) {
+    $sqltargs->{producer_args}{postgres_version} = $dver;
   }
 
   $self->next::method($schema, $type, $version, $dir, $sqltargs, @rest);

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/SQLite.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/SQLite.pm	2010-06-02 11:41:39 UTC (rev 9547)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/SQLite.pm	2010-06-02 12:14:04 UTC (rev 9548)
@@ -45,13 +45,17 @@
 }
 
 sub deployment_statements {
-  my $self = shift;;
+  my $self = shift;
   my ($schema, $type, $version, $dir, $sqltargs, @rest) = @_;
 
   $sqltargs ||= {};
 
-  if (my $version = $self->_server_info->{dbms_version}) {
-    $sqltargs->{producer_args}{sqlite_version} = $version;
+  if (
+    ! exists $sqltargs->{producer_args}{sqlite_version}
+      and
+    my $dver = $self->_server_info->{normalized_dbms_version}
+  ) {
+    $sqltargs->{producer_args}{sqlite_version} = $dver;
   }
 
   $self->next::method($schema, $type, $version, $dir, $sqltargs, @rest);

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/mysql.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/mysql.pm	2010-06-02 11:41:39 UTC (rev 9547)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/mysql.pm	2010-06-02 12:14:04 UTC (rev 9548)
@@ -51,6 +51,23 @@
   return 'MySQL';
 }
 
+sub deployment_statements {
+  my $self = shift;
+  my ($schema, $type, $version, $dir, $sqltargs, @rest) = @_;
+
+  $sqltargs ||= {};
+
+  if (
+    ! exists $sqltargs->{producer_args}{mysql_version}
+      and 
+    my $dver = $self->_server_info->{normalized_dbms_version}
+  ) {
+    $sqltargs->{producer_args}{mysql_version} = $dver;
+  }
+
+  $self->next::method($schema, $type, $version, $dir, $sqltargs, @rest);
+}
+
 sub _svp_begin {
     my ($self, $name) = @_;
 




More information about the Bast-commits mailing list