- renamed DBIx::Custom::Result::fetch_hash_first...
...to fethc_hash_one
| ... | ... |
@@ -1,3 +1,8 @@ |
| 1 |
+0.2106 |
|
| 2 |
+ - renamed DBIx::Custom::Result::fetch_hash_first to fethc_hash_one |
|
| 3 |
+ because first is misleading name. fethc_hash_first is DEPRECATED! |
|
| 4 |
+ - renamed DBIx::Custom::Result::fetch_first to fetch_one, |
|
| 5 |
+ because first is misleading name. fetch_first is DEPRECATED! |
|
| 1 | 6 |
0.2105 |
| 2 | 7 |
- added EXPERIMENTAL DBIx::Custom::Result::value method |
| 3 | 8 |
- added EXPERIMENTAL DBIx::Custom::Result::column method |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
package DBIx::Custom; |
| 2 | 2 |
use Object::Simple -base; |
| 3 | 3 |
|
| 4 |
-our $VERSION = '0.2105'; |
|
| 4 |
+our $VERSION = '0.2106'; |
|
| 5 | 5 |
use 5.008001; |
| 6 | 6 |
|
| 7 | 7 |
use Carp 'croak'; |
| ... | ... |
@@ -190,7 +190,7 @@ sub connect {
|
| 190 | 190 |
return $self; |
| 191 | 191 |
} |
| 192 | 192 |
|
| 193 |
-sub count { shift->select(column => 'count(*)', @_)->fetch_first->[0] }
|
|
| 193 |
+sub count { shift->select(column => 'count(*)', @_)->fetch_one->[0] }
|
|
| 194 | 194 |
|
| 195 | 195 |
sub dbh {
|
| 196 | 196 |
my $self = shift; |
| ... | ... |
@@ -3619,6 +3619,8 @@ L<DBIx::Custom::Result> |
| 3619 | 3619 |
filter_check # will be removed at 2017/1/1 |
| 3620 | 3620 |
|
| 3621 | 3621 |
# Methods |
| 3622 |
+ fetch_first # will be removed at 2017/2/1 |
|
| 3623 |
+ fetch_hash_first # will be removed 2017/2/1 |
|
| 3622 | 3624 |
filter_on # will be removed at 2017/1/1 |
| 3623 | 3625 |
filter_off # will be removed at 2017/1/1 |
| 3624 | 3626 |
end_filter # will be removed at 2017/1/1 |
| ... | ... |
@@ -162,19 +162,6 @@ sub fetch_all {
|
| 162 | 162 |
return $rows; |
| 163 | 163 |
} |
| 164 | 164 |
|
| 165 |
-sub fetch_first {
|
|
| 166 |
- my $self = shift; |
|
| 167 |
- |
|
| 168 |
- # Fetch |
|
| 169 |
- my $row = $self->fetch; |
|
| 170 |
- return unless $row; |
|
| 171 |
- |
|
| 172 |
- # Finish statement handle |
|
| 173 |
- $self->sth->finish; |
|
| 174 |
- |
|
| 175 |
- return $row; |
|
| 176 |
-} |
|
| 177 |
- |
|
| 178 | 165 |
sub fetch_hash_all {
|
| 179 | 166 |
my $self = shift; |
| 180 | 167 |
|
| ... | ... |
@@ -185,7 +172,7 @@ sub fetch_hash_all {
|
| 185 | 172 |
return $rows; |
| 186 | 173 |
} |
| 187 | 174 |
|
| 188 |
-sub fetch_hash_first {
|
|
| 175 |
+sub fetch_hash_one {
|
|
| 189 | 176 |
my $self = shift; |
| 190 | 177 |
|
| 191 | 178 |
# Fetch hash |
| ... | ... |
@@ -245,9 +232,23 @@ sub fetch_multi {
|
| 245 | 232 |
return $rows; |
| 246 | 233 |
} |
| 247 | 234 |
|
| 235 |
+ |
|
| 236 |
+sub fetch_one {
|
|
| 237 |
+ my $self = shift; |
|
| 238 |
+ |
|
| 239 |
+ # Fetch |
|
| 240 |
+ my $row = $self->fetch; |
|
| 241 |
+ return unless $row; |
|
| 242 |
+ |
|
| 243 |
+ # Finish statement handle |
|
| 244 |
+ $self->sth->finish; |
|
| 245 |
+ |
|
| 246 |
+ return $row; |
|
| 247 |
+} |
|
| 248 |
+ |
|
| 248 | 249 |
sub header { shift->sth->{NAME} }
|
| 249 | 250 |
|
| 250 |
-*one = \&fetch_hash_first; |
|
| 251 |
+*one = \&fetch_hash_one; |
|
| 251 | 252 |
|
| 252 | 253 |
sub type_rule {
|
| 253 | 254 |
my $self = shift; |
| ... | ... |
@@ -316,7 +317,7 @@ sub type_rule2_on {
|
| 316 | 317 |
|
| 317 | 318 |
sub value {
|
| 318 | 319 |
my $self = shift; |
| 319 |
- my $row = $self->fetch_first; |
|
| 320 |
+ my $row = $self->fetch_one; |
|
| 320 | 321 |
my $value = $row ? $row->[0] : undef; |
| 321 | 322 |
return $value; |
| 322 | 323 |
} |
| ... | ... |
@@ -338,6 +339,20 @@ sub _cache {
|
| 338 | 339 |
$self->{_cache} = 1;
|
| 339 | 340 |
} |
| 340 | 341 |
|
| 342 |
+# DEPRECATED! |
|
| 343 |
+sub fetch_hash_first {
|
|
| 344 |
+ my $self = shift; |
|
| 345 |
+ warn "DBIx::Custom::Result::fetch_hash_first is DEPRECATED! use fetch_hash_one instead"; |
|
| 346 |
+ return $self->fetch_hash_one(@_); |
|
| 347 |
+} |
|
| 348 |
+ |
|
| 349 |
+# DEPRECATED! |
|
| 350 |
+sub fetch_first {
|
|
| 351 |
+ my $self = shift; |
|
| 352 |
+ warn "DBIx::Custom::Result::fetch_first is DEPRECATED! use fetch_one instead"; |
|
| 353 |
+ return $self->fetch_one(@_); |
|
| 354 |
+} |
|
| 355 |
+ |
|
| 341 | 356 |
# DEPRECATED! |
| 342 | 357 |
sub filter_off {
|
| 343 | 358 |
warn "filter_off method is DEPRECATED!"; |
| ... | ... |
@@ -435,7 +450,7 @@ DBIx::Custom::Result - Result of select statement |
| 435 | 450 |
} |
| 436 | 451 |
|
| 437 | 452 |
# Fetch only a first row and put it into array reference |
| 438 |
- my $row = $result->fetch_first; |
|
| 453 |
+ my $row = $result->fetch_one; |
|
| 439 | 454 |
|
| 440 | 455 |
# Fetch all rows and put them into array of array reference |
| 441 | 456 |
my $rows = $result->fetch_all; |
| ... | ... |
@@ -447,12 +462,12 @@ DBIx::Custom::Result - Result of select statement |
| 447 | 462 |
} |
| 448 | 463 |
|
| 449 | 464 |
# Fetch only a first row and put it into hash reference |
| 450 |
- my $row = $result->fetch_hash_first; |
|
| 451 |
- my $row = $result->one; # Same as fetch_hash_first |
|
| 465 |
+ my $row = $result->fetch_hash_one; |
|
| 466 |
+ my $row = $result->one; # Alias for "fetch_hash_one" |
|
| 452 | 467 |
|
| 453 | 468 |
# Fetch all rows and put them into array of hash reference |
| 454 | 469 |
my $rows = $result->fetch_hash_all; |
| 455 |
- my $rows = $result->all; # Same as fetch_hash_all |
|
| 470 |
+ my $rows = $result->all; # Alias for "fetch_hash_all" |
|
| 456 | 471 |
|
| 457 | 472 |
=head1 ATTRIBUTES |
| 458 | 473 |
|
| ... | ... |
@@ -501,9 +516,9 @@ Fetch a row and put it into array reference. |
| 501 | 516 |
|
| 502 | 517 |
Fetch all rows and put them into array of array reference. |
| 503 | 518 |
|
| 504 |
-=head2 C<fetch_first> |
|
| 519 |
+=head2 C<fetch_one> |
|
| 505 | 520 |
|
| 506 |
- my $row = $result->fetch_first; |
|
| 521 |
+ my $row = $result->fetch_one; |
|
| 507 | 522 |
|
| 508 | 523 |
Fetch only a first row and put it into array reference, |
| 509 | 524 |
and finish statment handle. |
| ... | ... |
@@ -520,9 +535,9 @@ Fetch a row and put it into hash reference. |
| 520 | 535 |
|
| 521 | 536 |
Fetch all rows and put them into array of hash reference. |
| 522 | 537 |
|
| 523 |
-=head2 C<fetch_hash_first> |
|
| 538 |
+=head2 C<fetch_hash_one> |
|
| 524 | 539 |
|
| 525 |
- my $row = $result->fetch_hash_first; |
|
| 540 |
+ my $row = $result->fetch_hash_one; |
|
| 526 | 541 |
|
| 527 | 542 |
Fetch only a first row and put it into hash reference, |
| 528 | 543 |
and finish statment handle. |
| ... | ... |
@@ -558,7 +573,7 @@ Get header column names. |
| 558 | 573 |
|
| 559 | 574 |
my $row = $result->one; |
| 560 | 575 |
|
| 561 |
-Same as C<fetch_hash_first>. |
|
| 576 |
+Alias for C<fetch_hash_one>. |
|
| 562 | 577 |
|
| 563 | 578 |
=head2 C<stash> |
| 564 | 579 |
|
| ... | ... |
@@ -1197,6 +1197,12 @@ $dbi->execute($create_table1); |
| 1197 | 1197 |
$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
| 1198 | 1198 |
$result = $dbi->select(column => [$key1, $key1, $key2], table => $table1); |
| 1199 | 1199 |
$result->filter({$key1 => 'three_times'});
|
| 1200 |
+$row = $result->fetch_one; |
|
| 1201 |
+is_deeply($row, [3, 3, 4], "default_fetch_filter and filter"); |
|
| 1202 |
+ |
|
| 1203 |
+test 'fetch_first DEPRECATED!'; |
|
| 1204 |
+$result = $dbi->select(column => [$key1, $key1, $key2], table => $table1); |
|
| 1205 |
+$result->filter({$key1 => 'three_times'});
|
|
| 1200 | 1206 |
$row = $result->fetch_first; |
| 1201 | 1207 |
is_deeply($row, [3, 3, 4], "default_fetch_filter and filter"); |
| 1202 | 1208 |
|
| ... | ... |
@@ -1220,7 +1226,7 @@ $dbi->rollback; |
| 1220 | 1226 |
$dbi->dbh->{AutoCommit} = 1;
|
| 1221 | 1227 |
|
| 1222 | 1228 |
$result = $dbi->select(table => $table1); |
| 1223 |
-ok(! $result->fetch_first, "rollback"); |
|
| 1229 |
+ok(! $result->fetch_one, "rollback"); |
|
| 1224 | 1230 |
|
| 1225 | 1231 |
|
| 1226 | 1232 |
$dbi = DBIx::Custom->connect; |
| ... | ... |
@@ -1384,12 +1390,17 @@ $dbi->apply_filter( |
| 1384 | 1390 |
$key2 => {out => 'three_times', in => 'twice'});
|
| 1385 | 1391 |
$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
| 1386 | 1392 |
$result = $dbi->execute("select * from $table1");
|
| 1387 |
-$row = $result->fetch_hash_first; |
|
| 1393 |
+$row = $result->fetch_hash_one; |
|
| 1388 | 1394 |
is_deeply($row, {$key1 => 2, $key2 => 6}, "insert");
|
| 1389 | 1395 |
$result = $dbi->select(table => $table1); |
| 1390 | 1396 |
$row = $result->one; |
| 1391 | 1397 |
is_deeply($row, {$key1 => 6, $key2 => 12}, "insert");
|
| 1392 | 1398 |
|
| 1399 |
+test 'fetch_hash_first DEPRECATED!'; |
|
| 1400 |
+$result = $dbi->execute("select * from $table1");
|
|
| 1401 |
+$row = $result->fetch_hash_first; |
|
| 1402 |
+is_deeply($row, {$key1 => 2, $key2 => 6}, "insert");
|
|
| 1403 |
+ |
|
| 1393 | 1404 |
$dbi = DBIx::Custom->connect; |
| 1394 | 1405 |
eval { $dbi->execute("drop table $table1") };
|
| 1395 | 1406 |
$dbi->execute($create_table1); |
| ... | ... |
@@ -1533,7 +1544,7 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
| 1533 | 1544 |
$result = $dbi->select(table => $table1); |
| 1534 | 1545 |
$result->filter($key1 => sub { $_[0] * 2 }, $key2 => sub { $_[0] * 4 });
|
| 1535 | 1546 |
$result->end_filter($key1 => sub { $_[0] * 3 }, $key2 => sub { $_[0] * 5 });
|
| 1536 |
-$row = $result->fetch_first; |
|
| 1547 |
+$row = $result->fetch_one; |
|
| 1537 | 1548 |
is_deeply($row, [6, 40]); |
| 1538 | 1549 |
|
| 1539 | 1550 |
$dbi = DBIx::Custom->connect; |
| ... | ... |
@@ -1543,7 +1554,7 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
| 1543 | 1554 |
$result = $dbi->select(column => [$key1, $key1, $key2], table => $table1); |
| 1544 | 1555 |
$result->filter($key1 => sub { $_[0] * 2 }, $key2 => sub { $_[0] * 4 });
|
| 1545 | 1556 |
$result->end_filter($key1 => sub { $_[0] * 3 }, $key2 => sub { $_[0] * 5 });
|
| 1546 |
-$row = $result->fetch_first; |
|
| 1557 |
+$row = $result->fetch_one; |
|
| 1547 | 1558 |
is_deeply($row, [6, 6, 40]); |
| 1548 | 1559 |
|
| 1549 | 1560 |
$dbi = DBIx::Custom->connect; |
| ... | ... |
@@ -1553,7 +1564,7 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
| 1553 | 1564 |
$result = $dbi->select(table => $table1); |
| 1554 | 1565 |
$result->filter([$key1, $key2] => sub { $_[0] * 2 });
|
| 1555 | 1566 |
$result->end_filter([[$key1, $key2] => sub { $_[0] * 3 }]);
|
| 1556 |
-$row = $result->fetch_first; |
|
| 1567 |
+$row = $result->fetch_one; |
|
| 1557 | 1568 |
is_deeply($row, [6, 12]); |
| 1558 | 1569 |
|
| 1559 | 1570 |
$dbi = DBIx::Custom->connect; |
| ... | ... |
@@ -1563,7 +1574,7 @@ $dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
| 1563 | 1574 |
$result = $dbi->select(table => $table1); |
| 1564 | 1575 |
$result->filter([[$key1, $key2] => sub { $_[0] * 2 }]);
|
| 1565 | 1576 |
$result->end_filter([$key1, $key2] => sub { $_[0] * 3 });
|
| 1566 |
-$row = $result->fetch_first; |
|
| 1577 |
+$row = $result->fetch_one; |
|
| 1567 | 1578 |
is_deeply($row, [6, 12]); |
| 1568 | 1579 |
|
| 1569 | 1580 |
$dbi->register_filter(five_times => sub { $_[0] * 5 });
|
| ... | ... |
@@ -1613,7 +1624,7 @@ $row = $result |
| 1613 | 1624 |
->remove_filter |
| 1614 | 1625 |
->end_filter($key1 => sub { $_[0] * 3 }, $key2 => sub { $_[0] * 5 })
|
| 1615 | 1626 |
->remove_end_filter |
| 1616 |
- ->fetch_first; |
|
| 1627 |
+ ->fetch_one; |
|
| 1617 | 1628 |
is_deeply($row, [1, 2]); |
| 1618 | 1629 |
|
| 1619 | 1630 |
test 'empty where select'; |
| ... | ... |
@@ -4066,7 +4077,7 @@ $dbi->insert({$key1 => '2010-01-03'},
|
| 4066 | 4077 |
table => $table1, filter => {$key1 => sub { my $v = shift || ''; $v =~ s/3/4/; return $v }});
|
| 4067 | 4078 |
$result = $dbi->select(table => $table1); |
| 4068 | 4079 |
$result->filter($key1 => sub { my $v = shift || ''; $v =~ s/8/9/; return $v });
|
| 4069 |
-like($result->fetch_first->[0], qr/^2010-01-09/); |
|
| 4080 |
+like($result->fetch_one->[0], qr/^2010-01-09/); |
|
| 4070 | 4081 |
|
| 4071 | 4082 |
|
| 4072 | 4083 |
$dbi = DBIx::Custom->connect; |
| ... | ... |
@@ -4093,7 +4104,7 @@ $result->type_rule( |
| 4093 | 4104 |
} |
| 4094 | 4105 |
); |
| 4095 | 4106 |
$result->filter($key1 => sub { my $v = shift || ''; $v =~ s/8/9/; return $v });
|
| 4096 |
-like($result->fetch_first->[0], qr/^2010-01-09/); |
|
| 4107 |
+like($result->fetch_one->[0], qr/^2010-01-09/); |
|
| 4097 | 4108 |
|
| 4098 | 4109 |
test 'type_rule_off'; |
| 4099 | 4110 |
$dbi = DBIx::Custom->connect; |
| ... | ... |
@@ -4333,9 +4344,9 @@ $dbi->type_rule( |
| 4333 | 4344 |
); |
| 4334 | 4345 |
$dbi->insert({$key1 => '2010-01-03'}, table => $table1, type_rule_off => 1);
|
| 4335 | 4346 |
$result = $dbi->select(table => $table1); |
| 4336 |
-like($result->type_rule_off->fetch_first->[0], qr/^2010-01-03/); |
|
| 4347 |
+like($result->type_rule_off->fetch_one->[0], qr/^2010-01-03/); |
|
| 4337 | 4348 |
$result = $dbi->select(table => $table1); |
| 4338 |
-like($result->type_rule_on->fetch_first->[0], qr/^2010-01-07/); |
|
| 4349 |
+like($result->type_rule_on->fetch_one->[0], qr/^2010-01-07/); |
|
| 4339 | 4350 |
|
| 4340 | 4351 |
$dbi = DBIx::Custom->connect; |
| 4341 | 4352 |
eval { $dbi->execute("drop table $table1") };
|
| ... | ... |
@@ -4357,9 +4368,9 @@ $dbi->type_rule( |
| 4357 | 4368 |
); |
| 4358 | 4369 |
$dbi->insert({$key1 => '2010-01-03'}, table => $table1, type_rule1_off => 1);
|
| 4359 | 4370 |
$result = $dbi->select(table => $table1); |
| 4360 |
-like($result->type_rule1_off->fetch_first->[0], qr/^2010-01-05/); |
|
| 4371 |
+like($result->type_rule1_off->fetch_one->[0], qr/^2010-01-05/); |
|
| 4361 | 4372 |
$result = $dbi->select(table => $table1); |
| 4362 |
-like($result->type_rule1_on->fetch_first->[0], qr/^2010-01-07/); |
|
| 4373 |
+like($result->type_rule1_on->fetch_one->[0], qr/^2010-01-07/); |
|
| 4363 | 4374 |
|
| 4364 | 4375 |
$dbi = DBIx::Custom->connect; |
| 4365 | 4376 |
eval { $dbi->execute("drop table $table1") };
|
| ... | ... |
@@ -4381,9 +4392,9 @@ $dbi->type_rule( |
| 4381 | 4392 |
); |
| 4382 | 4393 |
$dbi->insert({$key1 => '2010-01-03'}, table => $table1, type_rule2_off => 1);
|
| 4383 | 4394 |
$result = $dbi->select(table => $table1); |
| 4384 |
-like($result->type_rule2_off->fetch_first->[0], qr/^2010-01-06/); |
|
| 4395 |
+like($result->type_rule2_off->fetch_one->[0], qr/^2010-01-06/); |
|
| 4385 | 4396 |
$result = $dbi->select(table => $table1); |
| 4386 |
-like($result->type_rule2_on->fetch_first->[0], qr/^2010-01-07/); |
|
| 4397 |
+like($result->type_rule2_on->fetch_one->[0], qr/^2010-01-07/); |
|
| 4387 | 4398 |
|
| 4388 | 4399 |
test 'join'; |
| 4389 | 4400 |
$dbi = DBIx::Custom->connect; |
| ... | ... |
@@ -209,7 +209,7 @@ test 'dbh'; |
| 209 | 209 |
my $dbi = DBIx::Custom->connect(connector => $connector); |
| 210 | 210 |
$dbi->delete_all(table => 'table1'); |
| 211 | 211 |
$dbi->do('insert into table1 (key1, key2) values (1, 2)');
|
| 212 |
- is($dbi->select(table => 'table1')->fetch_hash_first->{key1}, 1);
|
|
| 212 |
+ is($dbi->select(table => 'table1')->fetch_hash_one->{key1}, 1);
|
|
| 213 | 213 |
|
| 214 | 214 |
$dbi = DBIx::Custom->new; |
| 215 | 215 |
$dbi->dbh('a');
|
| ... | ... |
@@ -293,12 +293,12 @@ test 'fork'; |
| 293 | 293 |
if ($pid) {
|
| 294 | 294 |
# Parent |
| 295 | 295 |
my $result = $dbi->select(table => 'table1'); |
| 296 |
- is_deeply($result->fetch_hash_first, {key1 => 1, key2 => 2});
|
|
| 296 |
+ is_deeply($result->fetch_hash_one, {key1 => 1, key2 => 2});
|
|
| 297 | 297 |
} |
| 298 | 298 |
else {
|
| 299 | 299 |
# Child |
| 300 | 300 |
my $result = $dbi->select(table => 'table1'); |
| 301 |
- die "Not OK" unless $result->fetch_hash_first->{key1} == 1;
|
|
| 301 |
+ die "Not OK" unless $result->fetch_hash_one->{key1} == 1;
|
|
| 302 | 302 |
} |
| 303 | 303 |
} |
| 304 | 304 |
|
| ... | ... |
@@ -54,12 +54,12 @@ test 'connector => 1'; |
| 54 | 54 |
if ($pid) {
|
| 55 | 55 |
# Parent |
| 56 | 56 |
my $result = $dbi->select(table => 'table1'); |
| 57 |
- is_deeply($result->fetch_hash_first, {key1 => 1, key2 => 2});
|
|
| 57 |
+ is_deeply($result->fetch_hash_one, {key1 => 1, key2 => 2});
|
|
| 58 | 58 |
} |
| 59 | 59 |
else {
|
| 60 | 60 |
# Child |
| 61 | 61 |
my $result = $dbi->select(table => 'table1'); |
| 62 |
- die "Not OK" unless $result->fetch_hash_first->{key1} == 1;
|
|
| 62 |
+ die "Not OK" unless $result->fetch_hash_one->{key1} == 1;
|
|
| 63 | 63 |
} |
| 64 | 64 |
} |
| 65 | 65 |
|
| ... | ... |
@@ -157,20 +157,20 @@ $dbi->insert({key1 => 1, key2 => 2}, table => 'table1');
|
| 157 | 157 |
$dbi->insert({key1 => 3, key2 => 4}, table => 'table1');
|
| 158 | 158 |
|
| 159 | 159 |
$result = $dbi->select(table => 'table1'); |
| 160 |
-$row = $result->fetch_first; |
|
| 160 |
+$row = $result->fetch_one; |
|
| 161 | 161 |
is_deeply($row, [1, 2], "row"); |
| 162 | 162 |
$row = $result->fetch; |
| 163 | 163 |
ok(!$row, "finished"); |
| 164 | 164 |
|
| 165 | 165 |
$result = $dbi->select(table => 'table1'); |
| 166 |
-$row = $result->fetch_hash_first; |
|
| 166 |
+$row = $result->fetch_hash_one; |
|
| 167 | 167 |
is_deeply($row, {key1 => 1, key2 => 2}, "row");
|
| 168 | 168 |
$row = $result->fetch_hash; |
| 169 | 169 |
ok(!$row, "finished"); |
| 170 | 170 |
|
| 171 | 171 |
$dbi->execute('create table table2 (key1, key2);');
|
| 172 | 172 |
$result = $dbi->select(table => 'table2'); |
| 173 |
-$row = $result->fetch_hash_first; |
|
| 173 |
+$row = $result->fetch_hash_one; |
|
| 174 | 174 |
ok(!$row, "no row fetch"); |
| 175 | 175 |
|
| 176 | 176 |
$dbi = DBIx::Custom->connect; |
| ... | ... |
@@ -254,7 +254,7 @@ $dbi->type_rule( |
| 254 | 254 |
$dbi->execute("create table table1 (key1 Date, key2 datetime)");
|
| 255 | 255 |
$dbi->insert({key1 => 'a'}, table => 'table1');
|
| 256 | 256 |
$result = $dbi->select(table => 'table1'); |
| 257 |
-is($result->fetch_first->[0], 'A'); |
|
| 257 |
+is($result->fetch_one->[0], 'A'); |
|
| 258 | 258 |
|
| 259 | 259 |
$result = $dbi->select(table => 'table1'); |
| 260 | 260 |
is($result->one->{key1}, 'A');
|
| ... | ... |
@@ -287,19 +287,19 @@ $result = $dbi->select( |
| 287 | 287 |
table => ['table2', 'table3'], relation => {'table2.table3_id' => 'table3.id'},
|
| 288 | 288 |
column => ['table3.name as table3__name'] |
| 289 | 289 |
); |
| 290 |
-is($result->fetch_first->[0], 'B'); |
|
| 290 |
+is($result->fetch_one->[0], 'B'); |
|
| 291 | 291 |
|
| 292 | 292 |
$result = $dbi->select( |
| 293 | 293 |
table => 'table2', relation => {'table2.table3_id' => 'table3.id'},
|
| 294 | 294 |
column => ['table3.name as table3__name'] |
| 295 | 295 |
); |
| 296 |
-is($result->fetch_first->[0], 'B'); |
|
| 296 |
+is($result->fetch_one->[0], 'B'); |
|
| 297 | 297 |
|
| 298 | 298 |
$result = $dbi->select( |
| 299 | 299 |
table => 'table2', relation => {'table2.table3_id' => 'table3.id'},
|
| 300 | 300 |
column => ['table3.name as "table3.name"'] |
| 301 | 301 |
); |
| 302 |
-is($result->fetch_first->[0], 'B'); |
|
| 302 |
+is($result->fetch_one->[0], 'B'); |
|
| 303 | 303 |
|
| 304 | 304 |
test 'reserved_word_quote'; |
| 305 | 305 |
$dbi = DBIx::Custom->connect; |