Broken bind in php?
| From: | Paul Vallee | Date: | Thu, 20 Jul 2000 18:15:34 +0000 |
| Subject: | Broken bind in php? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-1360@lists.php.net to get a copy of this message | ||
Hi,
We are trying to help a client with a migration of some code from perl to
php. Unfortunately, they are having the following problem.
We have made sure that the oracle environment is set identically from an NLS
standpoint on the client and the server. The perl code (also below) works
well and binds fine.
Any ideas from the list?
Thanks in advance,
Paul
This is the function in question. I can hard code the values in OCIParse
to specific values rather than the placeholder ":mid". The two
validMessage and validJobNum functions ensure that the two variables only
are digits and nothing else. If they weren't, the OCIExecute that is
being complained about whould never be reached.
---
function messageDelete($dbh,$jobnum,$messageIDs,$listid)
{
if(!validJobNum($jobnum))
return(0);
$account=ereg_replace("'","''",$jobnum);
if(!$stmt=OCIParse($dbh,"delete from mstats where job_num=$jobnum and
message_id=:mid"))
return(0);
OCIBindByName($stmt,":mid",&$mid);
foreach ($messageIDs as $mid)
{
print "$jobnum,$mid";
if(validMessageId($mid))
OCIExecute($stmt);
}
return(messageRenumber($dbh,$jobnum,$listid));
}
---
This is what is printed.
10465,42OCIStmtExecute: ORA-01460 unimplemented or unreasonable conversion
requested in "messageOp.inc" on line 24
the 10465,42 is a result of the printing to make sure there isn't any
giberish falling through.
this is the equivalent of it in perl
---
use DBI;
require "/nc/include/ncglobal-2.ph";
$dbh=open_connection("bert");
$dbh->{RaiseError} = 1; # save having to check each method call
$jobnum=10465;
$sth = $dbh->prepare("delete from mstats where job_num=$jobnum and
message_id=?");
$x=42;
$sth->execute($x);
---
oracle client on the machine is 8.0.5 and the server is running 8.1.5 (or
is that .6)
the environment includes NLS_LANG=american_america.us7ascii
all columns in the table are of type number, message_id can hold 10
digits, though i'm inserting a 2 digit number.