#36143 [Opn->Asn]: bindParam on UPDATE error
| From: | tony2001@php.net | Date: | Wed, 25 Jan 2006 12:34:01 +0000 |
| Subject: | #36143 [Opn->Asn]: bindParam on UPDATE error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-92472@lists.php.net to get a copy of this message | ||
ID: 36143
Updated by: tony2001@php.net
Reported By: lvm99 at mail dot ru
-Status: Open
+Status: Assigned
Bug Type: PDO related
Operating System: Windows
PHP Version: 5.1.2
Assigned To: wez
New Comment:
>It very actual to fix this error quick because
Get the sources and fix it yourself if you want it quick.
Otherwise you have to wait for the maintainer to take a look at it and
(maybe) fix it.
Please don't change status of the report, it's assigned to the
maintainer.
Previous Comments:
------------------------------------------------------------------------
[2006-01-25 13:26:03] lvm99 at mail dot ru
It very actual to fix this error quick because in ODBC function quote()
is not implemented so We cant use simple sql without parameters :-(
I cant use MSSQL under PDO because it works with OEM charset and dont
implement CHARSET opt handling under Windows :-(
So some Russian characters in CP1251 encoding (which actually used in
Windows filenames, texts, etc.) are absent in cp866 (russian OEM
encoding).
Should I report about MSSQL BUG separately (In manual they recomend
dont use it on windows as useing absolete DBLIB direct access to MSSQL
Server)?
------------------------------------------------------------------------
[2006-01-25 13:18:42] tony2001@php.net
Assigned to the maintainer.
------------------------------------------------------------------------
[2006-01-25 13:04:10] lvm99 at mail dot ru
Here You can fild "working" test base and script
http://converters.ru/PHP_TEST_PDO.ZIP
On my PC script inserts all fields to :id
and updates all fields to :id
------------------------------------------------------------------------
[2006-01-24 14:53:04] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.
If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2006-01-24 14:41:20] lvm99 at mail dot ru
Description:
------------
ODBC connection to MSSQL
$sql = "UPDATE sources_test SET title=:title, name=:name WHERE
id=:id";
$sth = $db->prepare($sql);
$params = array(':title'=>'updated with params',
':name'=>'new name', ':id'=>'9586850')
$isOk = $sth->execute($params);
all param's fields (title, name) filling with ':id' value i.e.
'9586850'
If I bind just 'id' as param UPDATE works right
or
If I bind 'title' and 'name' but not id UPDATE works right
or
If I connect throut MSSQL interface everything is OK
Reproduce code:
---------------
//MSSQL Server 2000
$dsn ='server';
$database = 'testbase';
$login ='us';
$password = 'us';
//...
$db = new PDO("odbc:Driver={SQL Server}; Server=".$dsn.";
Database=".$database, $login, $password, array(PDO::ERRMODE_EXCEPTION
=> true));
//...
$sql = "UPDATE sources_test SET title=:title, name=:name WHERE
id=:id";
$sth = $db->prepare($sql);
$params = array(':title'=>'updated with params',
':name'=>'new name', ':id'=>'9586850')
$isOk = $sth->execute($params);
Expected result:
----------------
Fields have to be set to
name = 'new name'
title='updated with params'
Actual result:
--------------
name = '9586850'
title= '9586850'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36143&edit=1