| ... | ... |
@@ -9,10 +9,11 @@ $ENV{DBIX_CUSTOM_SKIP_MESSAGE} = 'mysql private test';
|
| 9 | 9 |
use DBIx::Custom; |
| 10 | 10 |
{
|
| 11 | 11 |
package DBIx::Custom; |
| 12 |
+ |
|
| 12 | 13 |
no warnings 'redefine'; |
| 13 |
- sub dsn { "dbi:mysql:database=dbix_custom" }
|
|
| 14 |
- sub user { 'dbix_custom' }
|
|
| 15 |
- sub password { 'dbix_custom' }
|
|
| 14 |
+ has dsn => "dbi:mysql:database=dbix_custom"; |
|
| 15 |
+ has user => 'dbix_custom'; |
|
| 16 |
+ has password => 'dbix_custom'; |
|
| 16 | 17 |
|
| 17 | 18 |
sub create_table1 { 'create table table1 (key1 varchar(255), key2 varchar(255));' }
|
| 18 | 19 |
sub create_table1_2 {'create table table1 (key1 varchar(255), key2 varchar(255), '
|
| ... | ... |
@@ -10,9 +10,9 @@ use DBIx::Custom; |
| 10 | 10 |
{
|
| 11 | 11 |
package DBIx::Custom; |
| 12 | 12 |
no warnings 'redefine'; |
| 13 |
- sub dsn { "dbi:Pg:dbname=dbix_custom" }
|
|
| 14 |
- sub user { 'dbix_custom' }
|
|
| 15 |
- sub password { 'dbix_custom' }
|
|
| 13 |
+ has dsn => "dbi:Pg:dbname=dbix_custom"; |
|
| 14 |
+ has user => 'dbix_custom'; |
|
| 15 |
+ has password => 'dbix_custom'; |
|
| 16 | 16 |
|
| 17 | 17 |
sub create_table1 { 'create table table1 (key1 varchar(255), key2 varchar(255));' }
|
| 18 | 18 |
sub create_table1_2 {'create table table1 (key1 varchar(255), key2 varchar(255), '
|
| ... | ... |
@@ -8,7 +8,7 @@ use DBIx::Custom; |
| 8 | 8 |
{
|
| 9 | 9 |
package DBIx::Custom; |
| 10 | 10 |
no warnings 'redefine'; |
| 11 |
- sub dsn { 'dbi:SQLite:dbname=:memory:' }
|
|
| 11 |
+ has dsn => 'dbi:SQLite:dbname=:memory:'; |
|
| 12 | 12 |
sub quote { '""' }
|
| 13 | 13 |
sub create_table1 { 'create table table1 (key1, key2);' }
|
| 14 | 14 |
sub create_table1_2 {'create table table1 (key1, key2, key3, key4, key5);' }
|
| ... | ... |
@@ -8,7 +8,7 @@ use DBIx::Custom; |
| 8 | 8 |
{
|
| 9 | 9 |
package DBIx::Custom; |
| 10 | 10 |
no warnings 'redefine'; |
| 11 |
- sub dsn { 'dbi:SQLite:dbname=:memory:' }
|
|
| 11 |
+ has dsn => 'dbi:SQLite:dbname=:memory:'; |
|
| 12 | 12 |
sub create_table1 { 'create table table1 (key1, key2);' }
|
| 13 | 13 |
sub create_table1_2 {'create table table1 (key1, key2, key3, key4, key5);' }
|
| 14 | 14 |
} |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
use Test::More; |
| 2 | 2 |
use strict; |
| 3 | 3 |
use warnings; |
| 4 |
-use DBIx::Custom; |
|
| 4 |
+use DBIx::Custom; |
|
| 5 | 5 |
|
| 6 | 6 |
my $dbi; |
| 7 | 7 |
|
| ... | ... |
@@ -238,6 +238,12 @@ $result = $dbi->execute( |
| 238 | 238 |
$rows = $result->all; |
| 239 | 239 |
is_deeply($rows, [{key1 => 'a:b c:d', key2 => 2}]);
|
| 240 | 240 |
|
| 241 |
+test 'Error case'; |
|
| 242 |
+eval {DBIx::Custom->connect(dsn => 'dbi:SQLit')};
|
|
| 243 |
+ok($@, "connect error"); |
|
| 244 |
+ |
|
| 245 |
+eval{$dbi->execute("{p }", {}, query => 1)};
|
|
| 246 |
+ok($@, "create_query invalid SQL template"); |
|
| 241 | 247 |
|
| 242 | 248 |
|
| 243 | 249 |
1; |
| ... | ... |
@@ -57,13 +57,6 @@ my $join; |
| 57 | 57 |
# Prepare table |
| 58 | 58 |
$dbi = DBIx::Custom->connect(%memory); |
| 59 | 59 |
|
| 60 |
-test 'Error case'; |
|
| 61 |
-eval {DBIx::Custom->connect(dsn => 'dbi:SQLit')};
|
|
| 62 |
-ok($@, "connect error"); |
|
| 63 |
- |
|
| 64 |
-$dbi = DBIx::Custom->connect(%memory); |
|
| 65 |
-eval{$dbi->execute("{p }", {}, query => 1)};
|
|
| 66 |
-ok($@, "create_query invalid SQL template"); |
|
| 67 | 60 |
|
| 68 | 61 |
test 'insert'; |
| 69 | 62 |
$dbi = DBIx::Custom->connect(%memory); |