[Bast-commits] r5316 - in DBIx-Class/0.08/trunk/t: . lib lib/DBICTest lib/DBICTest/Schema

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Sat Jan 17 18:47:53 GMT 2009


Author: ribasushi
Date: 2009-01-17 18:47:53 +0000 (Sat, 17 Jan 2009)
New Revision: 5316

Added:
   DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/BindType.pm
Modified:
   DBIx-Class/0.08/trunk/t/bindtype_columns.t
   DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema.pm
   DBIx-Class/0.08/trunk/t/lib/sqlite.sql
Log:
Fix borked t/bindtype_columns.t - TODO: still only tests PG, need to test Oracle as well

Modified: DBIx-Class/0.08/trunk/t/bindtype_columns.t
===================================================================
--- DBIx-Class/0.08/trunk/t/bindtype_columns.t	2009-01-17 18:39:50 UTC (rev 5315)
+++ DBIx-Class/0.08/trunk/t/bindtype_columns.t	2009-01-17 18:47:53 UTC (rev 5316)
@@ -19,46 +19,32 @@
 {
     local $SIG{__WARN__} = sub {};
     $dbh->do('DROP TABLE IF EXISTS artist');
+
+    # 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 artist
+        CREATE TABLE bindtype_test 
         (
-            artistid        serial       NOT NULL   PRIMARY KEY,
-            media           bytea        NOT NULL,
-            name            varchar(100) NULL,
-            rank            integer NOT  NULL       DEFAULT '13',
-            charfield       char(10)     NULL
+            id              serial       NOT NULL   PRIMARY KEY,
+            bytea           bytea        NULL,
+            blob            bytea        NULL,
+            clob            text         NULL
         );
     ],{ RaiseError => 1, PrintError => 1 });
 }
 
-$schema->class('Artist')->load_components(qw/ 
-
-	PK::Auto 
-	Core 
-/);
-
-$schema->class('Artist')->add_columns(
-	
-	"media", { 
-	
-		data_type => "bytea", 
-		is_nullable => 0,
-	},
-);
-
 # test primary key handling
 my $big_long_string	= 'abcd' x 250000;
 
-my $new = $schema->resultset('Artist')->create({ media => $big_long_string });
+my $new = $schema->resultset('BindType')->create({ bytea => $big_long_string });
 
-ok($new->artistid, "Created a blob row");
-is($new->media, 	$big_long_string, "Set the blob correctly.");
+ok($new->id, "Created a bytea row");
+is($new->bytea, 	$big_long_string, "Set the blob correctly.");
 
-my $rs = $schema->resultset('Artist')->find({artistid=>$new->artistid});
+my $rs = $schema->resultset('BindType')->find({ id => $new->id });
 
-is($rs->get_column('media'), $big_long_string, "Created the blob correctly.");
+is($rs->get_column('bytea'), $big_long_string, "Created the blob correctly.");
 
-$dbh->do("DROP TABLE artist");
+$dbh->do("DROP TABLE bindtype_test");
 
 
 

Added: DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/BindType.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/BindType.pm	                        (rev 0)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/BindType.pm	2009-01-17 18:47:53 UTC (rev 5316)
@@ -0,0 +1,29 @@
+package # hide from PAUSE 
+    DBICTest::Schema::BindType;
+
+use base 'DBIx::Class::Core';
+
+__PACKAGE__->table('bindtype_test');
+
+__PACKAGE__->add_columns(
+  'id' => {
+    data_type => 'integer',
+    is_auto_increment => 1,
+  },
+  'bytea' => {
+    data_type => 'bytea',
+    is_nullable => 1,
+  },
+  'blob' => {
+    data_type => 'blob',
+    is_nullable => 1,
+  },
+  'clob' => {
+    data_type => 'clob',
+    is_nullable => 1,
+  },
+);
+
+__PACKAGE__->set_primary_key('id');
+
+1;

Modified: DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema.pm	2009-01-17 18:39:50 UTC (rev 5315)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema.pm	2009-01-17 18:47:53 UTC (rev 5316)
@@ -8,6 +8,7 @@
 __PACKAGE__->load_classes(qw/
   Artist
   SequenceTest
+  BindType
   Employee
   CD
   FileColumn

Modified: DBIx-Class/0.08/trunk/t/lib/sqlite.sql
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/sqlite.sql	2009-01-17 18:39:50 UTC (rev 5315)
+++ DBIx-Class/0.08/trunk/t/lib/sqlite.sql	2009-01-17 18:47:53 UTC (rev 5316)
@@ -1,6 +1,6 @@
 -- 
 -- Created by SQL::Translator::Producer::SQLite
--- Created on Mon Nov 17 02:53:11 2008
+-- Created on Sat Jan 17 19:40:47 2009
 -- 
 BEGIN TRANSACTION;
 
@@ -38,6 +38,17 @@
 CREATE INDEX cd_artwork_idx_cd_id_cd_artwor ON cd_artwork (cd_id);
 
 --
+-- Table: bindtype_test
+--
+CREATE TABLE bindtype_test (
+  id INTEGER PRIMARY KEY NOT NULL,
+  bytea blob,
+  blob blob,
+  clob clob
+);
+
+
+--
 -- Table: bookmark
 --
 CREATE TABLE bookmark (




More information about the Bast-commits mailing list