... | ... |
@@ -254,6 +254,7 @@ sub delete { |
254 | 254 |
|
255 | 255 |
# Arguments |
256 | 256 |
my $table = $args{table} || ''; |
257 |
+ croak qq{"table" option must be specified} unless $table; |
|
257 | 258 |
my $where = $args{where} || {}; |
258 | 259 |
my $append = $args{append}; |
259 | 260 |
my $filter = $args{filter}; |
... | ... |
@@ -402,7 +403,8 @@ sub insert { |
402 | 403 |
} |
403 | 404 |
|
404 | 405 |
# Arguments |
405 |
- my $table = $args{table} || ''; |
|
406 |
+ my $table = $args{table}; |
|
407 |
+ croak qq{"table" option must be specified} unless $table; |
|
406 | 408 |
my $param = $args{param} || {}; |
407 | 409 |
my $append = $args{append} || ''; |
408 | 410 |
my $filter = $args{filter}; |
... | ... |
@@ -489,8 +491,11 @@ sub select { |
489 | 491 |
} |
490 | 492 |
|
491 | 493 |
# Arguments |
492 |
- my $tables = $args{table} || []; |
|
493 |
- $tables = [$tables] unless ref $tables eq 'ARRAY'; |
|
494 |
+ my $table = $args{table}; |
|
495 |
+ my $tables = ref $table eq 'ARRAY' ? $table |
|
496 |
+ : defined $table ? [$table] |
|
497 |
+ : []; |
|
498 |
+ croak qq{"table" option must be specified} unless @$tables; |
|
494 | 499 |
my $columns = $args{column} || []; |
495 | 500 |
my $where = $args{where}; |
496 | 501 |
my $relation = $args{relation}; |
... | ... |
@@ -622,6 +627,7 @@ sub update { |
622 | 627 |
|
623 | 628 |
# Arguments |
624 | 629 |
my $table = $args{table} || ''; |
630 |
+ croak qq{"table" option must be specified} unless $table; |
|
625 | 631 |
my $param = $args{param} || {}; |
626 | 632 |
my $where = $args{where} || {}; |
627 | 633 |
my $append = $args{append} || ''; |
... | ... |
@@ -32,7 +32,7 @@ sub connect { |
32 | 32 |
|
33 | 33 |
=head1 NAME |
34 | 34 |
|
35 |
-DBIx::Custom::MySQL - MySQL implementation |
|
35 |
+DBIx::Custom::MySQL - DEPRECATED! |
|
36 | 36 |
|
37 | 37 |
=head1 CAUTION |
38 | 38 |
|
... | ... |
@@ -38,7 +38,7 @@ sub connect_memory { |
38 | 38 |
|
39 | 39 |
=head1 NAME |
40 | 40 |
|
41 |
-DBIx::Custom::SQLite - SQLite implementation |
|
41 |
+DBIx::Custom::SQLite - DEPRECATED! |
|
42 | 42 |
|
43 | 43 |
=head1 CAUTION |
44 | 44 |
|
... | ... |
@@ -922,4 +922,13 @@ $dbi->register_tag_processor( |
922 | 922 |
); |
923 | 923 |
is($dbi->query_builder->tag_processors->{a}->(), 1); |
924 | 924 |
|
925 |
- |
|
925 |
+test 'table not specify exception'; |
|
926 |
+$dbi = DBIx::Custom->connect($NEW_ARGS->{0}); |
|
927 |
+eval {$dbi->insert}; |
|
928 |
+like($@, qr/table/); |
|
929 |
+eval {$dbi->update}; |
|
930 |
+like($@, qr/table/); |
|
931 |
+eval {$dbi->delete}; |
|
932 |
+like($@, qr/table/); |
|
933 |
+eval {$dbi->select}; |
|
934 |
+like($@, qr/table/); |