bind_param question
- From: kjackson@xxxxxxxxx (Keith Jackson)
- Date: Tue, 21 Jun 2005 11:21:31 -0400
The following code works just fine:
$sth = $dbh->prepare(qq(select count(*) from discounts where min_value
< ?));
$sth->bind_param( 1, 5, SQL_INTEGER);
$sth->execute();
The actual query my application uses is much longer and the rest of the
values in the where clause are varchar's.
Is there a way to assign the data type by column, then doing the execute
with the value?
Something like this:
$sth = $dbh->prepare(qq(select count(*) from discounts where min_value
< ?));
$sth->bind_param(1, SQL_INTEGER);
$sth->execute(5);
This would help too if the execute is in a loop.
like this...
$sth = $dbh->prepare(qq(select count(*) from discounts where min_value
< ? and code=?));
$sth->bind_param(1, SQL_INTEGER);
foreach (@( $myArrayHash) ){
$sth->execute($myArrayHash{'min'},$myArrayHash{'code'});
....
}
Any thoughts?
- Follow-Ups:
- Re: bind_param question
- From: Rudy Lippan
- Re: bind_param question
- Prev by Date: bug report: latest DBI leaks memory
- Next by Date: Re: bind_param question
- Previous by thread: bug report: latest DBI leaks memory
- Next by thread: Re: bind_param question
- Index(es):
Relevant Pages
|
|