[Bast-commits] r6478 - in DBIx-Class/0.08/trunk: . t t/bind

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Mon Jun 1 14:40:41 GMT 2009


Author: ribasushi
Date: 2009-06-01 14:40:41 +0000 (Mon, 01 Jun 2009)
New Revision: 6478

Added:
   DBIx-Class/0.08/trunk/t/bind/
   DBIx-Class/0.08/trunk/t/bind/attribute.t
   DBIx-Class/0.08/trunk/t/bind/bindtype_columns.t
   DBIx-Class/0.08/trunk/t/bind/order_by.t
Removed:
   DBIx-Class/0.08/trunk/t/47bind_attribute.t
   DBIx-Class/0.08/trunk/t/bindtype_columns.t
   DBIx-Class/0.08/trunk/t/order/
Modified:
   DBIx-Class/0.08/trunk/
Log:
 r6464 at Thesaurus (orig r6463):  ribasushi | 2009-05-30 16:55:37 +0200
 Restructure bind tests



Property changes on: DBIx-Class/0.08/trunk
___________________________________________________________________
Name: svk:merge
   - 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/resultsetcolumn_custom_columns:5160
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/sqla_1.50_compat:5414
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/trunk:5969
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class:32260
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class-CDBICompat:54993
9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/DBIx-Class:31122
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_column_attr:10946
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_trunk:11142
bd5ac9a7-f185-4d95-9186-dbb8b392a572:/local/os/bast/DBIx-Class/0.08/trunk:2798
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/belongs_to_null_col_fix:5244
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cdbicompat_integration:4160
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/column_attr:5074
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/count_distinct:6218
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/diamond_relationships:6310
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/fix-update-and-delete-as_query:6162
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/joined_count:6323
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/multi_stuff:5565
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle-tweaks:6222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle_sequence:4173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/order_by_refactor:6462
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch:5699
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/rt_bug_41083:5437
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/savepoints:4223
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sqla_1.50_compat:5321
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-ms-access:4142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-tweaks:6262
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subclassed_rsset:5930
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subquery:5617
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase:5651
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_mssql:6125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/top_limit_altfix:6429
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioned_enhancements:4125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioning:4578
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/views:5585
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-C3:318
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-current:2222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-joins:173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-resultset:570
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/datetime:1716
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_compat:1855
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_unique_query_fixes:2142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/inflate:1988
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/many_to_many:2025
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/re_refactor_bugfix:1944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/reorganize_tests:1827
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset-new-refactor:1766
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_2_electric_boogaloo:2175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_cleanup:2102
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/sqlt_tests_refactor:2043
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class:3606
fe160bb6-dc1c-0410-9f2b-d64a711b54a5:/local/DBIC-trunk-0.08:10510
   + 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/resultsetcolumn_custom_columns:5160
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/branches/sqla_1.50_compat:5414
4d5fae46-8e6a-4e08-abee-817e9fb894a2:/local/bast/DBIx-Class/0.08/trunk:5969
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class:32260
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class-CDBICompat:54993
9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/DBIx-Class:31122
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_column_attr:10946
ab17426e-7cd3-4704-a2a2-80b7c0a611bb:/local/dbic_trunk:11142
bd5ac9a7-f185-4d95-9186-dbb8b392a572:/local/os/bast/DBIx-Class/0.08/trunk:2798
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/belongs_to_null_col_fix:5244
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/cdbicompat_integration:4160
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/column_attr:5074
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/complex_join_rels:4589
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/count_distinct:6218
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/diamond_relationships:6310
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/file_column:3920
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/fix-update-and-delete-as_query:6162
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/joined_count:6323
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/multi_stuff:5565
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle-tweaks:6222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/oracle_sequence:4173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/order_by_refactor:6463
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/parser_fk_index:4485
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/prefetch:5699
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/replication_dedux:4600
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/rt_bug_41083:5437
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/savepoints:4223
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sqla_1.50_compat:5321
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-ms-access:4142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/storage-tweaks:6262
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subclassed_rsset:5930
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/subquery:5617
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase:5651
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/sybase_mssql:6125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/top_limit_altfix:6429
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioned_enhancements:4125
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/versioning:4578
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/views:5585
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-C3:318
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-current:2222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-joins:173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-resultset:570
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/datetime:1716
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_compat:1855
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_unique_query_fixes:2142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/inflate:1988
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/many_to_many:2025
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/re_refactor_bugfix:1944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/reorganize_tests:1827
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset-new-refactor:1766
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_2_electric_boogaloo:2175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_cleanup:2102
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/sqlt_tests_refactor:2043
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class:3606
fe160bb6-dc1c-0410-9f2b-d64a711b54a5:/local/DBIC-trunk-0.08:10510

Deleted: DBIx-Class/0.08/trunk/t/47bind_attribute.t
===================================================================
--- DBIx-Class/0.08/trunk/t/47bind_attribute.t	2009-06-01 14:40:30 UTC (rev 6477)
+++ DBIx-Class/0.08/trunk/t/47bind_attribute.t	2009-06-01 14:40:41 UTC (rev 6478)
@@ -1,96 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-use lib qw(t/lib);
-use DBIC::SqlMakerTest;
-
-use_ok('DBICTest');
-
-my $schema = DBICTest->init_schema;
-
-BEGIN {
-    eval "use DBD::SQLite";
-    plan $@
-        ? ( skip_all => 'needs DBD::SQLite for testing' )
-        : ( tests => 9 );
-}
-
-my $where_bind = {
-    where => \'name like ?',
-    bind  => [ 'Cat%' ],
-};
-
-my $rs;
-
-TODO: {
-    local $TODO = 'bind args order needs fixing (semifor)';
-
-    # First, the simple cases...
-    $rs = $schema->resultset('Artist')->search(
-            { artistid => 1 },
-            $where_bind,
-    );
-
-    is ( $rs->count, 1, 'where/bind combined' );
-
-    $rs= $schema->resultset('Artist')->search({}, $where_bind)
-        ->search({ artistid => 1});
-
-    is ( $rs->count, 1, 'where/bind first' );
-            
-    $rs = $schema->resultset('Artist')->search({ artistid => 1})
-        ->search({}, $where_bind);
-
-    is ( $rs->count, 1, 'where/bind last' );
-}
-
-# More complex cases, based primarily on the Cookbook
-# "Arbitrary SQL through a custom ResultSource" technique,
-# which seems to be the only place the bind attribute is
-# documented.  Breaking this technique probably breaks existing
-# application code.
-my $source = DBICTest::Artist->result_source_instance;
-my $new_source = $source->new($source);
-$new_source->source_name('Complex');
-
-$new_source->name(\<<'');
-( SELECT a.*, cd.cdid AS cdid, cd.title AS title, cd.year AS year 
-  FROM artist a
-  JOIN cd ON cd.artist = a.artistid
-  WHERE cd.year = ?)
-
-$schema->register_extra_source('Complex' => $new_source);
-
-$rs = $schema->resultset('Complex')->search({}, { bind => [ 1999 ] });
-is ( $rs->count, 1, 'cookbook arbitrary sql example' );
-
-$rs = $schema->resultset('Complex')->search({ 'artistid' => 1 }, { bind => [ 1999 ] });
-is ( $rs->count, 1, '...coobook + search condition' );
-
-$rs = $schema->resultset('Complex')->search({}, { bind => [ 1999 ] })
-    ->search({ 'artistid' => 1 });
-is ( $rs->count, 1, '...cookbook (bind first) + chained search' );
-
-{
-  $rs = $schema->resultset('Complex')->search({}, { bind => [ 1999 ] })->search({}, { where => \"title LIKE ?", bind => [ 'Spoon%' ] });
-  is_same_sql_bind(
-    $rs->as_query,
-    "(SELECT me.artistid, me.name, me.rank, me.charfield FROM (SELECT a.*, cd.cdid AS cdid, cd.title AS title, cd.year AS year FROM artist a JOIN cd ON cd.artist = a.artistid WHERE cd.year = ?) WHERE title LIKE ?)",
-    [
-      [ '!!dummy' => '1999' ], 
-      [ '!!dummy' => 'Spoon%' ]
-    ],
-    'got correct SQL'
-);
-
-}
-
-TODO: {
-    local $TODO = 'bind args order needs fixing (semifor)';
-    $rs = $schema->resultset('Complex')->search({}, { bind => [ 1999 ] })
-        ->search({ 'artistid' => 1 }, {
-            where => \'title like ?',
-            bind => [ 'Spoon%' ] });
-    is ( $rs->count, 1, '...cookbook + chained search with extra bind' );
-}

Copied: DBIx-Class/0.08/trunk/t/bind/attribute.t (from rev 6400, DBIx-Class/0.08/trunk/t/47bind_attribute.t)
===================================================================
--- DBIx-Class/0.08/trunk/t/bind/attribute.t	                        (rev 0)
+++ DBIx-Class/0.08/trunk/t/bind/attribute.t	2009-06-01 14:40:41 UTC (rev 6478)
@@ -0,0 +1,96 @@
+use strict;
+use warnings;
+
+use Test::More;
+use lib qw(t/lib);
+use DBIC::SqlMakerTest;
+
+use_ok('DBICTest');
+
+my $schema = DBICTest->init_schema;
+
+BEGIN {
+    eval "use DBD::SQLite";
+    plan $@
+        ? ( skip_all => 'needs DBD::SQLite for testing' )
+        : ( tests => 9 );
+}
+
+my $where_bind = {
+    where => \'name like ?',
+    bind  => [ 'Cat%' ],
+};
+
+my $rs;
+
+TODO: {
+    local $TODO = 'bind args order needs fixing (semifor)';
+
+    # First, the simple cases...
+    $rs = $schema->resultset('Artist')->search(
+            { artistid => 1 },
+            $where_bind,
+    );
+
+    is ( $rs->count, 1, 'where/bind combined' );
+
+    $rs= $schema->resultset('Artist')->search({}, $where_bind)
+        ->search({ artistid => 1});
+
+    is ( $rs->count, 1, 'where/bind first' );
+            
+    $rs = $schema->resultset('Artist')->search({ artistid => 1})
+        ->search({}, $where_bind);
+
+    is ( $rs->count, 1, 'where/bind last' );
+}
+
+# More complex cases, based primarily on the Cookbook
+# "Arbitrary SQL through a custom ResultSource" technique,
+# which seems to be the only place the bind attribute is
+# documented.  Breaking this technique probably breaks existing
+# application code.
+my $source = DBICTest::Artist->result_source_instance;
+my $new_source = $source->new($source);
+$new_source->source_name('Complex');
+
+$new_source->name(\<<'');
+( SELECT a.*, cd.cdid AS cdid, cd.title AS title, cd.year AS year 
+  FROM artist a
+  JOIN cd ON cd.artist = a.artistid
+  WHERE cd.year = ?)
+
+$schema->register_extra_source('Complex' => $new_source);
+
+$rs = $schema->resultset('Complex')->search({}, { bind => [ 1999 ] });
+is ( $rs->count, 1, 'cookbook arbitrary sql example' );
+
+$rs = $schema->resultset('Complex')->search({ 'artistid' => 1 }, { bind => [ 1999 ] });
+is ( $rs->count, 1, '...coobook + search condition' );
+
+$rs = $schema->resultset('Complex')->search({}, { bind => [ 1999 ] })
+    ->search({ 'artistid' => 1 });
+is ( $rs->count, 1, '...cookbook (bind first) + chained search' );
+
+{
+  $rs = $schema->resultset('Complex')->search({}, { bind => [ 1999 ] })->search({}, { where => \"title LIKE ?", bind => [ 'Spoon%' ] });
+  is_same_sql_bind(
+    $rs->as_query,
+    "(SELECT me.artistid, me.name, me.rank, me.charfield FROM (SELECT a.*, cd.cdid AS cdid, cd.title AS title, cd.year AS year FROM artist a JOIN cd ON cd.artist = a.artistid WHERE cd.year = ?) WHERE title LIKE ?)",
+    [
+      [ '!!dummy' => '1999' ], 
+      [ '!!dummy' => 'Spoon%' ]
+    ],
+    'got correct SQL'
+);
+
+}
+
+TODO: {
+    local $TODO = 'bind args order needs fixing (semifor)';
+    $rs = $schema->resultset('Complex')->search({}, { bind => [ 1999 ] })
+        ->search({ 'artistid' => 1 }, {
+            where => \'title like ?',
+            bind => [ 'Spoon%' ] });
+    is ( $rs->count, 1, '...cookbook + chained search with extra bind' );
+}

Copied: DBIx-Class/0.08/trunk/t/bind/bindtype_columns.t (from rev 6400, DBIx-Class/0.08/trunk/t/bindtype_columns.t)
===================================================================
--- DBIx-Class/0.08/trunk/t/bind/bindtype_columns.t	                        (rev 0)
+++ DBIx-Class/0.08/trunk/t/bind/bindtype_columns.t	2009-06-01 14:40:41 UTC (rev 6478)
@@ -0,0 +1,88 @@
+use strict;
+use warnings;  
+
+use Test::More;
+use lib qw(t/lib);
+use DBICTest;
+
+my ($dsn, $dbuser, $dbpass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
+
+plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
+  unless ($dsn && $dbuser);
+  
+plan tests => 6;
+
+my $schema = DBICTest::Schema->connection($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
+
+my $dbh = $schema->storage->dbh;
+
+{
+    local $SIG{__WARN__} = sub {};
+    $dbh->do('DROP TABLE IF EXISTS bindtype_test');
+
+    # the blob/clob are for reference only, will be useful when we switch to SQLT and can test Oracle along the way
+    $dbh->do(qq[
+        CREATE TABLE bindtype_test 
+        (
+            id              serial       NOT NULL   PRIMARY KEY,
+            bytea           bytea        NULL,
+            blob            bytea        NULL,
+            clob            text         NULL
+        );
+    ],{ RaiseError => 1, PrintError => 1 });
+}
+
+my $big_long_string	= "\x00\x01\x02 abcd" x 125000;
+
+my $new;
+# test inserting a row
+{
+  $new = $schema->resultset('BindType')->create({ bytea => $big_long_string });
+
+  ok($new->id, "Created a bytea row");
+  is($new->bytea, 	$big_long_string, "Set the blob correctly.");
+}
+
+# test retrieval of the bytea column
+{
+  my $row = $schema->resultset('BindType')->find({ id => $new->id });
+  is($row->get_column('bytea'), $big_long_string, "Created the blob correctly.");
+}
+
+TODO: {
+  local $TODO =
+    'Passing bind attributes to $sth->bind_param() should be implemented (it only works in $storage->insert ATM)';
+
+  my $rs = $schema->resultset('BindType')->search({ bytea => $big_long_string });
+
+  # search on the bytea column (select)
+  {
+    my $row = $rs->first;
+    is($row ? $row->id : undef, $new->id, "Found the row searching on the bytea column.");
+  }
+
+  # search on the bytea column (update)
+  {
+    my $new_big_long_string = $big_long_string . "2";
+    $schema->txn_do(sub {
+      $rs->update({ bytea => $new_big_long_string });
+      my $row = $schema->resultset('BindType')->find({ id => $new->id });
+      is($row ? $row->get_column('bytea') : undef, $new_big_long_string,
+        "Updated the row correctly (searching on the bytea column)."
+      );
+      $schema->txn_rollback;
+    });
+  }
+
+  # search on the bytea column (delete)
+  {
+    $schema->txn_do(sub {
+      $rs->delete;
+      my $row = $schema->resultset('BindType')->find({ id => $new->id });
+      is($row, undef, "Deleted the row correctly (searching on the bytea column).");
+      $schema->txn_rollback;
+    });
+  }
+}
+
+$dbh->do("DROP TABLE bindtype_test");

Copied: DBIx-Class/0.08/trunk/t/bind/order_by.t (from rev 6477, DBIx-Class/0.08/trunk/t/order/with_bind.t)
===================================================================
--- DBIx-Class/0.08/trunk/t/bind/order_by.t	                        (rev 0)
+++ DBIx-Class/0.08/trunk/t/bind/order_by.t	2009-06-01 14:40:41 UTC (rev 6478)
@@ -0,0 +1,106 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+use lib qw(t/lib);
+use DBICTest;
+use DBIC::SqlMakerTest;
+
+my $schema = DBICTest->init_schema;
+
+my $rs = $schema->resultset('FourKeys');
+
+sub test_order {
+
+  TODO: {
+    my $args = shift;
+
+    local $TODO = "Not implemented" if $args->{todo};
+
+    lives_ok {
+      is_same_sql_bind(
+        $rs->search(
+            { foo => 'bar' },
+            {
+                order_by => $args->{order_by},
+                having =>
+                  [ { read_count => { '>' => 5 } }, \[ 'read_count < ?', 8 ] ]
+            }
+          )->as_query,
+        "(
+          SELECT me.foo, me.bar, me.hello, me.goodbye, me.sensors, me.read_count 
+          FROM fourkeys me 
+          WHERE ( foo = ? ) 
+          HAVING read_count > ? OR read_count < ?
+          ORDER BY $args->{order_req}
+        )",
+        [
+            [qw(foo bar)],
+            [qw(read_count 5)],
+            8,
+            $args->{bind}
+              ? @{ $args->{bind} }
+              : ()
+        ],
+      );
+    };
+    fail('Fail the unfinished is_same_sql_bind') if $@;
+  }
+}
+
+my @tests = (
+    {
+        order_by  => \'foo DESC',
+        order_req => 'foo DESC',
+        bind      => [],
+    },
+    {
+        order_by  => { -asc => 'foo' },
+        order_req => 'foo ASC',
+        bind      => [],
+    },
+    {
+        order_by  => { -desc => \[ 'colA LIKE ?', 'test' ] },
+        order_req => 'colA LIKE ? DESC',
+        bind      => [qw(test)],
+    },
+    {
+        order_by  => \[ 'colA LIKE ? DESC', 'test' ],
+        order_req => 'colA LIKE ? DESC',
+        bind      => [qw(test)],
+    },
+    {
+        order_by => [
+            { -asc  => \['colA'] },
+            { -desc => \[ 'colB LIKE ?', 'test' ] },
+            { -asc  => \[ 'colC LIKE ?', 'tost' ] }
+        ],
+        order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC',
+        bind      => [qw(test tost)],
+    },
+
+    # (mo) this would be really really nice!
+    # (ribasushi) I don't think so, not writing it - patches welcome
+    {
+        order_by => [
+            { -asc  => 'colA' },
+            { -desc => { colB => { 'LIKE' => 'test' } } },
+            { -asc  => { colC => { 'LIKE' => 'tost' } } }
+        ],
+        order_req => 'colA ASC, colB LIKE ? DESC, colC LIKE ? ASC',
+        bind      => [ [ colB => 'test' ], [ colC => 'tost' ] ],      # ???
+        todo => 1,
+    },
+    {
+        order_by  => { -desc => { colA  => { LIKE  => 'test' } } },
+        order_req => 'colA LIKE ? DESC',
+        bind      => [qw(test)],
+        todo => 1,
+    },
+);
+
+plan( tests => scalar @tests * 2 );
+
+test_order($_) for @tests;
+

Deleted: DBIx-Class/0.08/trunk/t/bindtype_columns.t
===================================================================
--- DBIx-Class/0.08/trunk/t/bindtype_columns.t	2009-06-01 14:40:30 UTC (rev 6477)
+++ DBIx-Class/0.08/trunk/t/bindtype_columns.t	2009-06-01 14:40:41 UTC (rev 6478)
@@ -1,88 +0,0 @@
-use strict;
-use warnings;  
-
-use Test::More;
-use lib qw(t/lib);
-use DBICTest;
-
-my ($dsn, $dbuser, $dbpass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
-
-plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test'
-  unless ($dsn && $dbuser);
-  
-plan tests => 6;
-
-my $schema = DBICTest::Schema->connection($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
-
-my $dbh = $schema->storage->dbh;
-
-{
-    local $SIG{__WARN__} = sub {};
-    $dbh->do('DROP TABLE IF EXISTS bindtype_test');
-
-    # the blob/clob are for reference only, will be useful when we switch to SQLT and can test Oracle along the way
-    $dbh->do(qq[
-        CREATE TABLE bindtype_test 
-        (
-            id              serial       NOT NULL   PRIMARY KEY,
-            bytea           bytea        NULL,
-            blob            bytea        NULL,
-            clob            text         NULL
-        );
-    ],{ RaiseError => 1, PrintError => 1 });
-}
-
-my $big_long_string	= "\x00\x01\x02 abcd" x 125000;
-
-my $new;
-# test inserting a row
-{
-  $new = $schema->resultset('BindType')->create({ bytea => $big_long_string });
-
-  ok($new->id, "Created a bytea row");
-  is($new->bytea, 	$big_long_string, "Set the blob correctly.");
-}
-
-# test retrieval of the bytea column
-{
-  my $row = $schema->resultset('BindType')->find({ id => $new->id });
-  is($row->get_column('bytea'), $big_long_string, "Created the blob correctly.");
-}
-
-TODO: {
-  local $TODO =
-    'Passing bind attributes to $sth->bind_param() should be implemented (it only works in $storage->insert ATM)';
-
-  my $rs = $schema->resultset('BindType')->search({ bytea => $big_long_string });
-
-  # search on the bytea column (select)
-  {
-    my $row = $rs->first;
-    is($row ? $row->id : undef, $new->id, "Found the row searching on the bytea column.");
-  }
-
-  # search on the bytea column (update)
-  {
-    my $new_big_long_string = $big_long_string . "2";
-    $schema->txn_do(sub {
-      $rs->update({ bytea => $new_big_long_string });
-      my $row = $schema->resultset('BindType')->find({ id => $new->id });
-      is($row ? $row->get_column('bytea') : undef, $new_big_long_string,
-        "Updated the row correctly (searching on the bytea column)."
-      );
-      $schema->txn_rollback;
-    });
-  }
-
-  # search on the bytea column (delete)
-  {
-    $schema->txn_do(sub {
-      $rs->delete;
-      my $row = $schema->resultset('BindType')->find({ id => $new->id });
-      is($row, undef, "Deleted the row correctly (searching on the bytea column).");
-      $schema->txn_rollback;
-    });
-  }
-}
-
-$dbh->do("DROP TABLE bindtype_test");




More information about the Bast-commits mailing list