php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36143 bindParam on UPDATE error
Submitted: 2006-01-24 14:41 UTC Modified: 2006-04-17 01:00 UTC
Votes:4
Avg. Score:4.2 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (33.3%)
From: lvm99 at mail dot ru Assigned: wez (profile)
Status: No Feedback Package: PDO related
PHP Version: 5.1.2 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lvm99 at mail dot ru
New email:
PHP Version: OS:

 

 [2006-01-24 14:41 UTC] 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'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-24 14:53 UTC] 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-25 13:04 UTC] 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-25 13:18 UTC] tony2001@php.net
Assigned to the maintainer.
 [2006-01-25 13:26 UTC] 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:34 UTC] tony2001@php.net
>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.
 [2006-04-09 07:49 UTC] wez@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2006-04-17 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 07:01:27 2024 UTC