Bug #2976 Updated: odbc_execute miss-use SQLBindParameter
| From: | kalowsky@php.net | Date: | Wed, 22 May 2002 03:40:15 +0000 |
| Subject: | Bug #2976 Updated: odbc_execute miss-use SQLBindParameter | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-8157@lists.php.net to get a copy of this message | ||
ID: 2976
Updated by: kalowsky@php.net
Reported By: JimmyLee@openpath.com.tw
-Status: Duplicate
+Status: Closed
Bug Type: ODBC related
Operating System: WinNT 4.0
PHP Version: 4.0 Beta 3
Previous Comments:
------------------------------------------------------------------------
[2001-03-11 21:24:59] kalowsky@php.net
same as #6275
------------------------------------------------------------------------
[2001-02-13 15:56:09] kalowsky@php.net
I've begun to investigate many of the ODBC windows bugs... I'll see if
I can jump on this one as well... I miss FreeBSD already...
------------------------------------------------------------------------
[2001-02-13 15:40:01] cynic@php.net
i've sent a msg to the reporter, it got back. seems like he doesn't
work there anymore. anyone with MS Access willing to test the snippet?
------------------------------------------------------------------------
[2000-07-23 02:59:17] zak@cvs.php.net
I will do some testing and see if I can reproduce the error in a recent
release.
------------------------------------------------------------------------
[1999-12-14 22:40:29] JimmyLee@openpath.com.tw
while use odbc prepare, if query statment owns one more variables, odbc
execute will result wrong parameter binding if these variables are not
the same type. For example, in SQL Server 7, establish a table 'TABLE1'
with two columns: name:char(10), age:int, then try to insert some
records as follow : <br>
$conn = odbc_connect("SQL_7_DSN", "", "", SQL_CUR_DEFAULT) or
die("Connect error\n");
$stmt = odbc_prepare($conn, "insert into TABLE1 (name,age)
values(?,?)") or die("Prepare error\n");
#odbc_exec($conn, "insert into TABLE1 (name,age) values('abc',1)");
# odbc_exec works fine without error
for ($i=0; $i <= 10; $i++)
{
odbc_execute($stmt, array("abc".$i, $i));
}
odbc_close($conn);
But, if change "insert into TABLE1 (name,age) values (?,?)" to "insert
into TABLE1 (age,name) values (?,?)" and change odbc_execute($stmt,
array("abc".$i, $i)) to odbc_execute($stmt, array($i, "abc".$i)),
everything works fine in SQL Server. It seems odbc_execute did not bind
right parameter to right variables. I suggest add some function like
odbc_bindParameter(...) to set suitable type.
BTW, take MS Access as DSN, which one in the above will not works :(
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=2976&edit=1