Showing 4 changed files with 104 additions and 106 deletions
+23 -25
lib/DBIx/Custom.pm
... ...
@@ -170,7 +170,7 @@ sub create_query {
170 170
     return $query;
171 171
 }
172 172
 
173
-sub query{
173
+sub execute{
174 174
     my ($self, $query, $params, $args)  = @_;
175 175
     $params ||= {};
176 176
     
... ...
@@ -380,7 +380,7 @@ sub insert {
380 380
     $template .= " $append_statement" if $append_statement;
381 381
     
382 382
     # Execute query
383
-    my $ret_val = $self->query($template, $insert_params, {filter => $filter});
383
+    my $ret_val = $self->execute($template, $insert_params, {filter => $filter});
384 384
     
385 385
     return $ret_val;
386 386
 }
... ...
@@ -452,7 +452,7 @@ sub update {
452 452
     }
453 453
     
454 454
     # Execute query
455
-    my $ret_val = $self->query($template, $params, {filter => $filter});
455
+    my $ret_val = $self->execute($template, $params, {filter => $filter});
456 456
     
457 457
     return $ret_val;
458 458
 }
... ...
@@ -511,7 +511,7 @@ sub delete {
511 511
     $template .= " $append_statement" if $append_statement;
512 512
     
513 513
     # Execute query
514
-    my $ret_val = $self->query($template, $where_params, {filter => $filter});
514
+    my $ret_val = $self->execute($template, $where_params, {filter => $filter});
515 515
     
516 516
     return $ret_val;
517 517
 }
... ...
@@ -596,7 +596,7 @@ sub select {
596 596
     }
597 597
     
598 598
     # Execute query
599
-    my $result = $self->query($template, $where_params, {filter => $filter});
599
+    my $result = $self->execute($template, $where_params, {filter => $filter});
600 600
     
601 601
     return $result;
602 602
 }
... ...
@@ -648,10 +648,10 @@ This module is not stable. Method name and functionality will be change.
648 648
                                 user => 'ken', password => '!LFKD%$&');
649 649
     
650 650
     # Query
651
-    $dbi->query("select title from books");
651
+    $dbi->execute("select title from books");
652 652
     
653 653
     # Query with parameters
654
-    $dbi->query("select id from books where {= author} && {like title}",
654
+    $dbi->execute("select id from books where {= author} && {like title}",
655 655
                 {author => 'ken', title => '%Perl%'});
656 656
     
657 657
     # Insert 
... ...
@@ -767,7 +767,7 @@ Binding filter
767 767
     $dbi                 = $dbi->default_query_filter($default_query_filter);
768 768
     $default_query_filter = $dbi->default_query_filter
769 769
 
770
-The following is bind filter sample
770
+The following is bind filter example
771 771
     
772 772
     $dbi->resist_filter(encode_utf8 => sub {
773 773
         my $value = shift;
... ...
@@ -793,7 +793,7 @@ Fetching filter
793 793
     $dbi                  = $dbi->default_fetch_filter($default_fetch_filter);
794 794
     $default_fetch_filter = $dbi->default_fetch_filter;
795 795
 
796
-The following is fetch filter sample
796
+The following is fetch filter example
797 797
 
798 798
     $dbi->resist_filter(decode_utf8 => sub {
799 799
         my $value = shift;
... ...
@@ -874,7 +874,7 @@ Resist filter
874 874
     
875 875
     $dbi->resist_filter($fname1 => $filter1, $fname => $filter2);
876 876
     
877
-The following is resist_filter sample
877
+The following is resist_filter example
878 878
 
879 879
     $dbi->resist_filter(
880 880
         encode_utf8 => sub {
... ...
@@ -894,7 +894,7 @@ Add format
894 894
 
895 895
     $dbi->resist_format($fname1 => $format, $fname2 => $format2);
896 896
     
897
-The following is resist_format sample.
897
+The following is resist_format example.
898 898
 
899 899
     $dbi->resist_format(date => '%Y:%m:%d', datetime => '%Y-%m-%d %H:%M:%S');
900 900
 
... ...
@@ -906,19 +906,19 @@ Create Query object parsing SQL template
906 906
 
907 907
 $query is <DBIx::Query> object. This is executed by query method as the following
908 908
 
909
-    $dbi->query($query, $params);
909
+    $dbi->execute($query, $params);
910 910
 
911 911
 If you know SQL template, see also L<DBIx::Custom::SQLTemplate>.
912 912
 
913
-=head2 query
913
+=head2 execute
914 914
 
915 915
 Query
916 916
 
917
-    $result = $dbi->query($template, $params);
917
+    $result = $dbi->execute($template, $params);
918 918
 
919
-The following is query sample
919
+The following is query example
920 920
 
921
-    $result = $dbi->query("select * from authors where {= name} and {= age}", 
921
+    $result = $dbi->execute("select * from authors where {= name} and {= age}", 
922 922
                           {author => 'taro', age => 19});
923 923
     
924 924
     while (my @row = $result->fetch) {
... ...
@@ -927,9 +927,7 @@ The following is query sample
927 927
 
928 928
 If you now syntax of template, See also L<DBIx::Custom::SQLTemplate>
929 929
 
930
-Return value of query method is L<DBIx::Custom::Result> object
931
-
932
-See also L<DBIx::Custom::Result>.
930
+execute() return L<DBIx::Custom::Result> object
933 931
 
934 932
 =head2 transaction
935 933
 
... ...
@@ -971,7 +969,7 @@ Insert row
971 969
 
972 970
 Retrun value is affected rows count
973 971
     
974
-The following is insert sample.
972
+The following is insert example.
975 973
 
976 974
     $dbi->insert('books', {title => 'Perl', author => 'Taro'});
977 975
 
... ...
@@ -988,7 +986,7 @@ Update rows
988 986
 
989 987
 Retrun value is affected rows count
990 988
 
991
-The following is update sample.
989
+The following is update example.
992 990
 
993 991
     $dbi->update('books', {title => 'Perl', author => 'Taro'}, {id => 5});
994 992
 
... ...
@@ -1005,7 +1003,7 @@ Update all rows
1005 1003
 
1006 1004
 Retrun value is affected rows count
1007 1005
 
1008
-The following is update_all sample.
1006
+The following is update_all example.
1009 1007
 
1010 1008
     $dbi->update_all('books', {author => 'taro'});
1011 1009
 
... ...
@@ -1018,7 +1016,7 @@ Delete rows
1018 1016
 
1019 1017
 Retrun value is affected rows count
1020 1018
     
1021
-The following is delete sample.
1019
+The following is delete example.
1022 1020
 
1023 1021
     $dbi->delete('books', {id => 5});
1024 1022
 
... ...
@@ -1034,7 +1032,7 @@ Delete all rows
1034 1032
 
1035 1033
 Retrun value is affected rows count
1036 1034
 
1037
-The following is delete_all sample.
1035
+The following is delete_all example.
1038 1036
 
1039 1037
     $dbi->delete_all('books');
1040 1038
 
... ...
@@ -1052,7 +1050,7 @@ Select rows
1052 1050
 
1053 1051
 $reslt is L<DBIx::Custom::Result> object
1054 1052
 
1055
-The following is some select samples
1053
+The following is some select examples
1056 1054
 
1057 1055
     # select * from books;
1058 1056
     $result = $dbi->select('books');
+1 -1
lib/DBIx/Custom/Result.pm
... ...
@@ -179,7 +179,7 @@ DBIx::Custom::Result - DBIx::Custom Resultset
179 179
 
180 180
 =head1 SYNOPSIS
181 181
 
182
-    my $result = $dbi->query($query);
182
+    my $result = $dbi->execute($query);
183 183
     
184 184
     # Fetch
185 185
     while (my @row = $result->fetch) {
+75 -75
t/dbix-custom-core-sqlite.t
... ...
@@ -93,14 +93,14 @@ ok($@, "$test : table not exist");
93 93
 # Prepare table
94 94
 $dbi = DBIx::Custom->new($NEW_ARGS->{0});
95 95
 $dbi->connect;
96
-$dbi->query($CREATE_TABLE->{0});
96
+$dbi->execute($CREATE_TABLE->{0});
97 97
 $dbi->insert('table1', {key1 => 1, key2 => 2});
98 98
 $dbi->insert('table1', {key1 => 3, key2 => 4});
99 99
 
100 100
 test 'DBIx::Custom::Result test';
101 101
 $tmpl = "select key1, key2 from table1";
102 102
 $query = $dbi->create_query($tmpl);
103
-$result = $dbi->query($query);
103
+$result = $dbi->execute($query);
104 104
 
105 105
 @rows = ();
106 106
 while (my $row = $result->fetch) {
... ...
@@ -108,168 +108,168 @@ while (my $row = $result->fetch) {
108 108
 }
109 109
 is_deeply(\@rows, [[1, 2], [3, 4]], "$test : fetch scalar context");
110 110
 
111
-$result = $dbi->query($query);
111
+$result = $dbi->execute($query);
112 112
 @rows = ();
113 113
 while (my @row = $result->fetch) {
114 114
     push @rows, [@row];
115 115
 }
116 116
 is_deeply(\@rows, [[1, 2], [3, 4]], "$test : fetch list context");
117 117
 
118
-$result = $dbi->query($query);
118
+$result = $dbi->execute($query);
119 119
 @rows = ();
120 120
 while (my $row = $result->fetch_hash) {
121 121
     push @rows, {%$row};
122 122
 }
123 123
 is_deeply(\@rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "$test : fetch_hash scalar context");
124 124
 
125
-$result = $dbi->query($query);
125
+$result = $dbi->execute($query);
126 126
 @rows = ();
127 127
 while (my %row = $result->fetch_hash) {
128 128
     push @rows, {%row};
129 129
 }
130 130
 is_deeply(\@rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "$test : fetch hash list context");
131 131
 
132
-$result = $dbi->query($query);
132
+$result = $dbi->execute($query);
133 133
 $rows = $result->fetch_all;
134 134
 is_deeply($rows, [[1, 2], [3, 4]], "$test : fetch_all scalar context");
135 135
 
136
-$result = $dbi->query($query);
136
+$result = $dbi->execute($query);
137 137
 @rows = $result->fetch_all;
138 138
 is_deeply(\@rows, [[1, 2], [3, 4]], "$test : fetch_all list context");
139 139
 
140
-$result = $dbi->query($query);
140
+$result = $dbi->execute($query);
141 141
 @rows = $result->fetch_hash_all;
142 142
 is_deeply($rows, [[1, 2], [3, 4]], "$test : fetch_hash_all scalar context");
143 143
 
144
-$result = $dbi->query($query);
144
+$result = $dbi->execute($query);
145 145
 @rows = $result->fetch_all;
146 146
 is_deeply(\@rows, [[1, 2], [3, 4]], "$test : fetch_hash_all list context");
147 147
 
148 148
 
149 149
 test 'Insert query return value';
150
-$dbi->query($DROP_TABLE->{0});
151
-$dbi->query($CREATE_TABLE->{0});
150
+$dbi->execute($DROP_TABLE->{0});
151
+$dbi->execute($CREATE_TABLE->{0});
152 152
 $tmpl = "insert into table1 {insert key1 key2}";
153 153
 $query = $dbi->create_query($tmpl);
154
-$ret_val = $dbi->query($query, {key1 => 1, key2 => 2});
154
+$ret_val = $dbi->execute($query, {key1 => 1, key2 => 2});
155 155
 ok($ret_val, $test);
156 156
 
157 157
 
158 158
 test 'Direct query';
159
-$dbi->query($DROP_TABLE->{0});
160
-$dbi->query($CREATE_TABLE->{0});
159
+$dbi->execute($DROP_TABLE->{0});
160
+$dbi->execute($CREATE_TABLE->{0});
161 161
 $insert_tmpl = "insert into table1 {insert key1 key2}";
162
-$dbi->query($insert_tmpl, {key1 => 1, key2 => 2});
163
-$result = $dbi->query($SELECT_TMPLS->{0});
162
+$dbi->execute($insert_tmpl, {key1 => 1, key2 => 2});
163
+$result = $dbi->execute($SELECT_TMPLS->{0});
164 164
 $rows = $result->fetch_hash_all;
165 165
 is_deeply($rows, [{key1 => 1, key2 => 2}], $test);
166 166
 
167 167
 test 'Filter basic';
168
-$dbi->query($DROP_TABLE->{0});
169
-$dbi->query($CREATE_TABLE->{0});
168
+$dbi->execute($DROP_TABLE->{0});
169
+$dbi->execute($CREATE_TABLE->{0});
170 170
 $dbi->resist_filter(twice       => sub { $_[0] * 2}, 
171 171
                     three_times => sub { $_[0] * 3});
172 172
 
173 173
 $insert_tmpl  = "insert into table1 {insert key1 key2};";
174 174
 $insert_query = $dbi->create_query($insert_tmpl);
175 175
 $insert_query->filter({key1 => 'twice'});
176
-$dbi->query($insert_query, {key1 => 1, key2 => 2});
177
-$result = $dbi->query($SELECT_TMPLS->{0});
176
+$dbi->execute($insert_query, {key1 => 1, key2 => 2});
177
+$result = $dbi->execute($SELECT_TMPLS->{0});
178 178
 $rows = $result->filter({key2 => 'three_times'})->fetch_hash_all;
179 179
 is_deeply($rows, [{key1 => 2, key2 => 6}], "$test : filter fetch_filter");
180
-$dbi->query($DROP_TABLE->{0});
180
+$dbi->execute($DROP_TABLE->{0});
181 181
 
182 182
 test 'Filter in';
183
-$dbi->query($CREATE_TABLE->{0});
183
+$dbi->execute($CREATE_TABLE->{0});
184 184
 $insert_tmpl  = "insert into table1 {insert key1 key2};";
185 185
 $insert_query = $dbi->create_query($insert_tmpl);
186
-$dbi->query($insert_query, {key1 => 2, key2 => 4});
186
+$dbi->execute($insert_query, {key1 => 2, key2 => 4});
187 187
 $select_tmpl = "select * from table1 where {in table1.key1 2} and {in table1.key2 2}";
188 188
 $select_query = $dbi->create_query($select_tmpl);
189 189
 $select_query->filter({'table1.key1' => 'twice'});
190
-$result = $dbi->query($select_query, {'table1.key1' => [1,5], 'table1.key2' => [2,4]});
190
+$result = $dbi->execute($select_query, {'table1.key1' => [1,5], 'table1.key2' => [2,4]});
191 191
 $rows = $result->fetch_hash_all;
192 192
 is_deeply($rows, [{key1 => 2, key2 => 4}], "$test : filter");
193 193
 
194 194
 test 'DBIx::Custom::SQLTemplate basic tag';
195
-$dbi->query($DROP_TABLE->{0});
196
-$dbi->query($CREATE_TABLE->{1});
195
+$dbi->execute($DROP_TABLE->{0});
196
+$dbi->execute($CREATE_TABLE->{1});
197 197
 $dbi->insert('table1', {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
198 198
 $dbi->insert('table1', {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
199 199
 
200 200
 $tmpl = "select * from table1 where {= key1} and {<> key2} and {< key3} and {> key4} and {>= key5};";
201 201
 $query = $dbi->create_query($tmpl);
202
-$result = $dbi->query($query, {key1 => 1, key2 => 3, key3 => 4, key4 => 3, key5 => 5});
202
+$result = $dbi->execute($query, {key1 => 1, key2 => 3, key3 => 4, key4 => 3, key5 => 5});
203 203
 $rows = $result->fetch_hash_all;
204 204
 is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag1");
205 205
 
206 206
 $tmpl = "select * from table1 where {<= key1} and {like key2};";
207 207
 $query = $dbi->create_query($tmpl);
208
-$result = $dbi->query($query, {key1 => 1, key2 => '%2%'});
208
+$result = $dbi->execute($query, {key1 => 1, key2 => '%2%'});
209 209
 $rows = $result->fetch_hash_all;
210 210
 is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag2");
211 211
 
212 212
 test 'DIB::Custom::SQLTemplate in tag';
213
-$dbi->query($DROP_TABLE->{0});
214
-$dbi->query($CREATE_TABLE->{1});
213
+$dbi->execute($DROP_TABLE->{0});
214
+$dbi->execute($CREATE_TABLE->{1});
215 215
 $dbi->insert('table1', {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
216 216
 $dbi->insert('table1', {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
217 217
 
218 218
 $tmpl = "select * from table1 where {in key1 2};";
219 219
 $query = $dbi->create_query($tmpl);
220
-$result = $dbi->query($query, {key1 => [9, 1]});
220
+$result = $dbi->execute($query, {key1 => [9, 1]});
221 221
 $rows = $result->fetch_hash_all;
222 222
 is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic");
223 223
 
224 224
 test 'DBIx::Custom::SQLTemplate insert tag';
225
-$dbi->query("delete from table1");
225
+$dbi->execute("delete from table1");
226 226
 $insert_tmpl = 'insert into table1 {insert key1 key2 key3 key4 key5}';
227
-$dbi->query($insert_tmpl, {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
227
+$dbi->execute($insert_tmpl, {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
228 228
 
229
-$result = $dbi->query($SELECT_TMPLS->{0});
229
+$result = $dbi->execute($SELECT_TMPLS->{0});
230 230
 $rows = $result->fetch_hash_all;
231 231
 is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic");
232 232
 
233 233
 test 'DBIx::Custom::SQLTemplate update tag';
234
-$dbi->query("delete from table1");
234
+$dbi->execute("delete from table1");
235 235
 $insert_tmpl = "insert into table1 {insert key1 key2 key3 key4 key5}";
236
-$dbi->query($insert_tmpl, {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
237
-$dbi->query($insert_tmpl, {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
236
+$dbi->execute($insert_tmpl, {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
237
+$dbi->execute($insert_tmpl, {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
238 238
 
239 239
 $update_tmpl = 'update table1 {update key1 key2 key3 key4} where {= key5}';
240
-$dbi->query($update_tmpl, {key1 => 1, key2 => 1, key3 => 1, key4 => 1, key5 => 5});
240
+$dbi->execute($update_tmpl, {key1 => 1, key2 => 1, key3 => 1, key4 => 1, key5 => 5});
241 241
 
242
-$result = $dbi->query($SELECT_TMPLS->{0});
242
+$result = $dbi->execute($SELECT_TMPLS->{0});
243 243
 $rows = $result->fetch_hash_all;
244 244
 is_deeply($rows, [{key1 => 1, key2 => 1, key3 => 1, key4 => 1, key5 => 5},
245 245
                   {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], "$test : basic");
246 246
 
247 247
 test 'transaction';
248
-$dbi->query($DROP_TABLE->{0});
249
-$dbi->query($CREATE_TABLE->{0});
248
+$dbi->execute($DROP_TABLE->{0});
249
+$dbi->execute($CREATE_TABLE->{0});
250 250
 $dbi->run_transaction(sub {
251 251
     $insert_tmpl = 'insert into table1 {insert key1 key2}';
252
-    $dbi->query($insert_tmpl, {key1 => 1, key2 => 2});
253
-    $dbi->query($insert_tmpl, {key1 => 3, key2 => 4});
252
+    $dbi->execute($insert_tmpl, {key1 => 1, key2 => 2});
253
+    $dbi->execute($insert_tmpl, {key1 => 3, key2 => 4});
254 254
 });
255
-$result = $dbi->query($SELECT_TMPLS->{0});
255
+$result = $dbi->execute($SELECT_TMPLS->{0});
256 256
 $rows   = $result->fetch_hash_all;
257 257
 is_deeply($rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "$test : commit");
258 258
 
259
-$dbi->query($DROP_TABLE->{0});
260
-$dbi->query($CREATE_TABLE->{0});
259
+$dbi->execute($DROP_TABLE->{0});
260
+$dbi->execute($CREATE_TABLE->{0});
261 261
 $dbi->dbh->{RaiseError} = 0;
262 262
 eval{
263 263
     $dbi->run_transaction(sub {
264 264
         $insert_tmpl = 'insert into table1 {insert key1 key2}';
265
-        $dbi->query($insert_tmpl, {key1 => 1, key2 => 2});
265
+        $dbi->execute($insert_tmpl, {key1 => 1, key2 => 2});
266 266
         die "Fatal Error";
267
-        $dbi->query($insert_tmpl, {key1 => 3, key2 => 4});
267
+        $dbi->execute($insert_tmpl, {key1 => 3, key2 => 4});
268 268
     })
269 269
 };
270 270
 like($@, qr/Fatal Error.*Rollback is success/ms, "$test : Rollback success message");
271 271
 ok(!$dbi->dbh->{RaiseError}, "$test : restore RaiseError value");
272
-$result = $dbi->query($SELECT_TMPLS->{0});
272
+$result = $dbi->execute($SELECT_TMPLS->{0});
273 273
 $rows   = $result->fetch_hash_all;
274 274
 is_deeply($rows, [], "$test : rollback");
275 275
 
... ...
@@ -293,7 +293,7 @@ like($@, qr/AutoCommit must be true before transaction start/,
293 293
 
294 294
 $dbi = DBIx::Custom->new($NEW_ARGS->{0});
295 295
 $sql = 'laksjdf';
296
-eval{$dbi->query($sql, qw/1 2 3/)};
296
+eval{$dbi->execute($sql, qw/1 2 3/)};
297 297
 like($@, qr/$sql/, "$test : query fail");
298 298
 
299 299
 $dbi = DBIx::Custom->new($NEW_ARGS->{0});
... ...
@@ -302,22 +302,22 @@ ok($@, "$test : create_query invalid SQL template");
302 302
 
303 303
 test 'insert';
304 304
 $dbi = DBIx::Custom->new($NEW_ARGS->{0});
305
-$dbi->query($CREATE_TABLE->{0});
305
+$dbi->execute($CREATE_TABLE->{0});
306 306
 $dbi->insert('table1', {key1 => 1, key2 => 2});
307 307
 $dbi->insert('table1', {key1 => 3, key2 => 4});
308
-$result = $dbi->query($SELECT_TMPLS->{0});
308
+$result = $dbi->execute($SELECT_TMPLS->{0});
309 309
 $rows   = $result->fetch_hash_all;
310 310
 is_deeply($rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "$test : basic");
311 311
 
312
-$dbi->query('delete from table1');
312
+$dbi->execute('delete from table1');
313 313
 $dbi->resist_filter(three_times => sub { $_[0] * 3});
314 314
 $dbi->insert('table1', {key1 => 1, key2 => 2}, {filter => {key1 => 'three_times'}});
315
-$result = $dbi->query($SELECT_TMPLS->{0});
315
+$result = $dbi->execute($SELECT_TMPLS->{0});
316 316
 $rows   = $result->fetch_hash_all;
317 317
 is_deeply($rows, [{key1 => 3, key2 => 2}], "$test : filter");
318 318
 
319
-$dbi->query($DROP_TABLE->{0});
320
-$dbi->query($CREATE_TABLE->{0});
319
+$dbi->execute($DROP_TABLE->{0});
320
+$dbi->execute($CREATE_TABLE->{0});
321 321
 $dbi->insert('table1', {key1 => 1, key2 => 2}, {append => '   '});
322 322
 $rows = $dbi->select('table1')->fetch_hash_all;
323 323
 is_deeply($rows, [{key1 => 1, key2 => 2}], 'insert append');
... ...
@@ -329,33 +329,33 @@ like($@, qr/Key-value pairs for insert must be specified to 'insert' second argu
329 329
 
330 330
 test 'update';
331 331
 $dbi = DBIx::Custom->new($NEW_ARGS->{0});
332
-$dbi->query($CREATE_TABLE->{1});
332
+$dbi->execute($CREATE_TABLE->{1});
333 333
 $dbi->insert('table1', {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
334 334
 $dbi->insert('table1', {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
335 335
 $dbi->update('table1', {key2 => 11}, {where => {key1 => 1}});
336
-$result = $dbi->query($SELECT_TMPLS->{0});
336
+$result = $dbi->execute($SELECT_TMPLS->{0});
337 337
 $rows   = $result->fetch_hash_all;
338 338
 is_deeply($rows, [{key1 => 1, key2 => 11, key3 => 3, key4 => 4, key5 => 5},
339 339
                   {key1 => 6, key2 => 7,  key3 => 8, key4 => 9, key5 => 10}],
340 340
                   "$test : basic");
341 341
                   
342
-$dbi->query("delete from table1");
342
+$dbi->execute("delete from table1");
343 343
 $dbi->insert('table1', {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
344 344
 $dbi->insert('table1', {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
345 345
 $dbi->update('table1', {key2 => 12}, {where => {key2 => 2, key3 => 3}});
346
-$result = $dbi->query($SELECT_TMPLS->{0});
346
+$result = $dbi->execute($SELECT_TMPLS->{0});
347 347
 $rows   = $result->fetch_hash_all;
348 348
 is_deeply($rows, [{key1 => 1, key2 => 12, key3 => 3, key4 => 4, key5 => 5},
349 349
                   {key1 => 6, key2 => 7,  key3 => 8, key4 => 9, key5 => 10}],
350 350
                   "$test : update key same as search key");
351 351
 
352
-$dbi->query("delete from table1");
352
+$dbi->execute("delete from table1");
353 353
 $dbi->insert('table1', {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
354 354
 $dbi->insert('table1', {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
355 355
 $dbi->resist_filter(twice => sub { $_[0] * 2 });
356 356
 $dbi->update('table1', {key2 => 11}, {where => {key1 => 1},
357 357
               filter => {key2 => 'twice'}});
358
-$result = $dbi->query($SELECT_TMPLS->{0});
358
+$result = $dbi->execute($SELECT_TMPLS->{0});
359 359
 $rows   = $result->fetch_hash_all;
360 360
 is_deeply($rows, [{key1 => 1, key2 => 22, key3 => 3, key4 => 4, key5 => 5},
361 361
                   {key1 => 6, key2 => 7,  key3 => 8, key4 => 9, key5 => 10}],
... ...
@@ -366,7 +366,7 @@ $result = $dbi->update('table1', {key2 => 11}, {where => {key1 => 1}, append =>
366 366
 
367 367
 test 'update error';
368 368
 $dbi = DBIx::Custom->new($NEW_ARGS->{0});
369
-$dbi->query($CREATE_TABLE->{1});
369
+$dbi->execute($CREATE_TABLE->{1});
370 370
 eval{$dbi->update('table1')};
371 371
 like($@, qr/Key-value pairs for update must be specified to 'update' second argument/,
372 372
          "$test : update key-value pairs not specified");
... ...
@@ -377,12 +377,12 @@ like($@, qr/Key-value pairs for where clause must be specified to 'update' third
377 377
 
378 378
 test 'update_all';
379 379
 $dbi = DBIx::Custom->new($NEW_ARGS->{0});
380
-$dbi->query($CREATE_TABLE->{1});
380
+$dbi->execute($CREATE_TABLE->{1});
381 381
 $dbi->insert('table1', {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
382 382
 $dbi->insert('table1', {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
383 383
 $dbi->resist_filter(twice => sub { $_[0] * 2 });
384 384
 $dbi->update_all('table1', {key2 => 10}, {filter => {key2 => 'twice'}});
385
-$result = $dbi->query($SELECT_TMPLS->{0});
385
+$result = $dbi->execute($SELECT_TMPLS->{0});
386 386
 $rows   = $result->fetch_hash_all;
387 387
 is_deeply($rows, [{key1 => 1, key2 => 20, key3 => 3, key4 => 4, key5 => 5},
388 388
                   {key1 => 6, key2 => 20, key3 => 8, key4 => 9, key5 => 10}],
... ...
@@ -391,20 +391,20 @@ is_deeply($rows, [{key1 => 1, key2 => 20, key3 => 3, key4 => 4, key5 => 5},
391 391
 
392 392
 test 'delete';
393 393
 $dbi = DBIx::Custom->new($NEW_ARGS->{0});
394
-$dbi->query($CREATE_TABLE->{0});
394
+$dbi->execute($CREATE_TABLE->{0});
395 395
 $dbi->insert('table1', {key1 => 1, key2 => 2});
396 396
 $dbi->insert('table1', {key1 => 3, key2 => 4});
397 397
 $dbi->delete('table1', {where => {key1 => 1}});
398
-$result = $dbi->query($SELECT_TMPLS->{0});
398
+$result = $dbi->execute($SELECT_TMPLS->{0});
399 399
 $rows   = $result->fetch_hash_all;
400 400
 is_deeply($rows, [{key1 => 3, key2 => 4}], "$test : basic");
401 401
 
402
-$dbi->query("delete from table1;");
402
+$dbi->execute("delete from table1;");
403 403
 $dbi->insert('table1', {key1 => 1, key2 => 2});
404 404
 $dbi->insert('table1', {key1 => 3, key2 => 4});
405 405
 $dbi->resist_filter(twice => sub { $_[0] * 2 });
406 406
 $dbi->delete('table1', {where => {key2 => 1}, filter => {key2 => 'twice'}});
407
-$result = $dbi->query($SELECT_TMPLS->{0});
407
+$result = $dbi->execute($SELECT_TMPLS->{0});
408 408
 $rows   = $result->fetch_hash_all;
409 409
 is_deeply($rows, [{key1 => 3, key2 => 4}], "$test : filter");
410 410
 
... ...
@@ -420,25 +420,25 @@ is_deeply($rows, [{key1 => 3, key2 => 4}], "$test : delete multi key");
420 420
 
421 421
 test 'delete error';
422 422
 $dbi = DBIx::Custom->new($NEW_ARGS->{0});
423
-$dbi->query($CREATE_TABLE->{0});
423
+$dbi->execute($CREATE_TABLE->{0});
424 424
 eval{$dbi->delete('table1')};
425 425
 like($@, qr/Key-value pairs for where clause must be specified to 'delete' second argument/,
426 426
          "$test : where key-value pairs not specified");
427 427
 
428 428
 test 'delete_all';
429 429
 $dbi = DBIx::Custom->new($NEW_ARGS->{0});
430
-$dbi->query($CREATE_TABLE->{0});
430
+$dbi->execute($CREATE_TABLE->{0});
431 431
 $dbi->insert('table1', {key1 => 1, key2 => 2});
432 432
 $dbi->insert('table1', {key1 => 3, key2 => 4});
433 433
 $dbi->delete_all('table1');
434
-$result = $dbi->query($SELECT_TMPLS->{0});
434
+$result = $dbi->execute($SELECT_TMPLS->{0});
435 435
 $rows   = $result->fetch_hash_all;
436 436
 is_deeply($rows, [], "$test : basic");
437 437
 
438 438
 
439 439
 test 'select';
440 440
 $dbi = DBIx::Custom->new($NEW_ARGS->{0});
441
-$dbi->query($CREATE_TABLE->{0});
441
+$dbi->execute($CREATE_TABLE->{0});
442 442
 $dbi->insert('table1', {key1 => 1, key2 => 2});
443 443
 $dbi->insert('table1', {key1 => 3, key2 => 4});
444 444
 $rows = $dbi->select('table1')->fetch_hash_all;
... ...
@@ -462,7 +462,7 @@ $rows = $dbi->select('table1', {where => {key1 => 2}, filter => {key1 => 'decrem
462 462
             ->fetch_hash_all;
463 463
 is_deeply($rows, [{key1 => 1, key2 => 2}], "$test : filter");
464 464
 
465
-$dbi->query($CREATE_TABLE->{2});
465
+$dbi->execute($CREATE_TABLE->{2});
466 466
 $dbi->insert('table2', {key1 => 1, key3 => 5});
467 467
 $rows = $dbi->select([qw/table1 table2/],
468 468
                       {
... ...
@@ -476,7 +476,7 @@ is_deeply($rows, [{table1_key1 => 1, table2_key1 => 1, key2 => 2, key3 => 5}], "
476 476
 test 'Cache';
477 477
 $dbi = DBIx::Custom->new($NEW_ARGS->{0});
478 478
 DBIx::Custom->query_cache_max(2);
479
-$dbi->query($CREATE_TABLE->{0});
479
+$dbi->execute($CREATE_TABLE->{0});
480 480
 delete $DBIx::Custom::CLASS_ATTRS->{_query_caches};
481 481
 delete $DBIx::Custom::CLASS_ATTRS->{_query_cache_keys};
482 482
 $tmpls[0] = "insert into table1 {insert key1 key2}";
+5 -5
t/dbix-custom-sqlite.t
... ...
@@ -37,7 +37,7 @@ my $id;
37 37
 test 'connect_memory';
38 38
 $dbi = DBIx::Custom::SQLite->new;
39 39
 $dbi->connect_memory;
40
-$ret_val = $dbi->query($CREATE_TABLE->{0});
40
+$ret_val = $dbi->execute($CREATE_TABLE->{0});
41 41
 ok(defined $ret_val, $test);
42 42
 $dbi->insert('table1', {key1 => 'a', key2 => 2});
43 43
 $rows = $dbi->select('table1', {where => {key1 => 'a'}})->fetch_hash_all;
... ...
@@ -50,10 +50,10 @@ like($@, qr/Already connected/, "$test : already connected");
50 50
 test 'reconnect_memory';
51 51
 $dbi = DBIx::Custom::SQLite->new;
52 52
 $dbi->reconnect_memory;
53
-$ret_val = $dbi->query($CREATE_TABLE->{0});
53
+$ret_val = $dbi->execute($CREATE_TABLE->{0});
54 54
 ok(defined $ret_val, "$test : connect first");
55 55
 $dbi->reconnect_memory;
56
-$ret_val = $dbi->query($CREATE_TABLE->{2});
56
+$ret_val = $dbi->execute($CREATE_TABLE->{2});
57 57
 ok(defined $ret_val, "$test : connect first");
58 58
 
59 59
 test 'connect';
... ...
@@ -62,7 +62,7 @@ unlink $db_file if -f $db_file;
62 62
 $dbi = DBIx::Custom::SQLite->new(database => $db_file);
63 63
 $dbi->connect;
64 64
 ok(-f $db_file, "$test : database file");
65
-$ret_val = $dbi->query($CREATE_TABLE->{0});
65
+$ret_val = $dbi->execute($CREATE_TABLE->{0});
66 66
 ok(defined $ret_val, "$test : database");
67 67
 $dbi->disconnect;
68 68
 unlink $db_file if -f $db_file;
... ...
@@ -70,7 +70,7 @@ unlink $db_file if -f $db_file;
70 70
 test 'last_insert_rowid';
71 71
 $dbi = DBIx::Custom::SQLite->new;
72 72
 $dbi->connect_memory;
73
-$ret_val = $dbi->query($CREATE_TABLE->{0});
73
+$ret_val = $dbi->execute($CREATE_TABLE->{0});
74 74
 $dbi->insert('table1', {key1 => 1, key2 => 2});
75 75
 is($dbi->last_insert_rowid, 1, "$test: first");
76 76
 $dbi->insert('table1', {key1 => 1, key2 => 2});