deployment_statements() and cursor_class() are storage-dependent
Peter Rabbitson [Tue, 9 Apr 2013 13:26:52 +0000 (15:26 +0200)]
We need some sort of generic test for this, so we stop dropping stuff
on the floor. The logic is something like "if a public method is overriden
in a DBI:: subclass - we need to mark it for resolution". E.g.

rabbit@Thesaurus:~/devel/dbic/dbgit$ grep deployment_statements -r lib/DBIx/Class/Storage/DBI/
lib/DBIx/Class/Storage/DBI/Pg.pm:sub deployment_statements {
lib/DBIx/Class/Storage/DBI/Replicated.pm:    deployment_statements
lib/DBIx/Class/Storage/DBI/mysql.pm:sub deployment_statements {
lib/DBIx/Class/Storage/DBI/SQLite.pm:sub deployment_statements {
lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm:sub deployment_statements {

Changes
lib/DBIx/Class/Storage/DBI.pm
t/storage/deploy.t

diff --git a/Changes b/Changes
index 7709d3a..e8ec6c5 100644 (file)
--- a/Changes
+++ b/Changes
@@ -54,6 +54,8 @@ Revision history for DBIx::Class
         - Stop Sybase ASE storage from generating invalid SQL in subselects
           when a limit without offset is encountered
         - Even more robust behavior of GenericSubQuery limit dialect
+        - Make sure deployment_statements() and cursor_class() are called on
+          a resolved storage subclass
 
 0.08210 2013-04-04 15:30 (UTC)
     * New Features / Changes
index 16850a3..5a39029 100644 (file)
@@ -86,17 +86,23 @@ sub _determine_supports_join_optimizer { 1 };
 # _determine_supports_X which obv. needs a correct driver as well
 my @rdbms_specific_methods = qw/
   sqlt_type
+  deployment_statements
+
   sql_maker
+  cursor_class
+
   build_datetime_parser
   datetime_parser_type
 
   txn_begin
+
   insert
   insert_bulk
   update
   delete
   select
   select_single
+
   with_deferred_fk_checks
 
   get_use_dbms_capability
index 233da2c..78e2c8c 100644 (file)
@@ -3,6 +3,7 @@ use warnings;
 
 use Test::More;
 use Test::Exception;
+use Path::Class qw/dir/;
 
 use lib qw(t/lib);
 use DBICTest;
@@ -14,8 +15,13 @@ BEGIN {
     unless DBIx::Class::Optional::Dependencies->req_ok_for ('deploy')
 }
 
-use File::Spec;
-use Path::Class qw/dir/;
+# this is how maint/gen_schema did it (connect() to force a storage
+# instance, but no conninfo)
+# there ought to be more code like this in the wild
+like(
+  DBICTest::Schema->connect->deployment_statements('SQLite'),
+  qr/\bCREATE TABLE\b/i
+);
 
 lives_ok( sub {
     my $parse_schema = DBICTest->init_schema(no_deploy => 1);