|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
potential error in binding values caught
I have been using the code below for some time now with out problems. However I recently noticed that
my $rv = $sth->execute || die $sth->errstr; $rv = has $rv = after ; Is this correct? Does it set $sth->execute(@bind_values) to $rv? Or is the $rv = after ; just ignored? Would it be safe to remove $rv = ? Thanks Code:
my $sql = qq{ SELECT id FROM data WHERE ITEM = '$ref->[0]' and time_expire < '$epoch_today' };
my $sth = $dbh->prepare( $sql );
$sth->execute();
# for capturing number of rows
my $rv = $sth->execute || die $sth->errstr; $rv =
$sth->execute(@bind_values) || die $sth->errstr;
# Don't need the database connection anymore
$sth->finish();
$dbh->disconnect();
|
|
#2
|
|||
|
|||
|
How is this different? Do I even need both? All what I want is the number of rows returned from my select statment placed into $rv.
# Modified statement handle methods. my $rv = $sth->execute; my $rv = $sth->execute(@bind_values); If called with no arguments, or with a simple list, execute() operates normally. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > potential error in binding values caught |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|