MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old May 15th, 2004, 12:28 AM
easy_coder easy_coder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 421 easy_coder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 12 h 50 m 2 sec
Reputation Power: 5
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();

Reply With Quote
  #2  
Old May 15th, 2004, 12:38 AM
easy_coder easy_coder is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 421 easy_coder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 12 h 50 m 2 sec
Reputation Power: 5
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > potential error in binding values caught


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway