Bug #64828 [Opn->Dup]: PDO_ODBC via unixodbc + mssql driver 11
| From: | cmb@php.net | Date: | Mon, 05 Oct 2020 13:07:28 +0000 |
| Subject: | Bug #64828 [Opn->Dup]: PDO_ODBC via unixodbc + mssql driver 11 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-229401@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64828&edit=1
ID: 64828
Updated by: cmb@php.net
Reported by: jdavis at grantstream dot com
Summary: PDO_ODBC via unixodbc + mssql driver 11
-Status: Open
+Status: Duplicate
Type: Bug
-Package: ODBC related
+Package: PDO ODBC
Operating System: Linux 2.6.18-238.1.1.1.el5 x86_6
PHP Version: 5.3.25
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I'm marking this as duplicate of bug #74186, since that ticket
already has been analyzed.
Previous Comments:
------------------------------------------------------------------------
[2013-05-13 15:49:37] jdavis at grantstream dot com
Description:
------------
While trying to bind either a 'value' or a 'parameter' via PDO_ODBC there is an
error.
I can successfully perform the very same functionality via php odbc calls (odbc_connect,
odbc_prepare, odbc_execute, etc...).
Related to: https://bugs.php.net/bug.php?id=61777
PDO_ODBC is not allowing binding due to 64bit incompatibility.
NOTE: We are running Zend Server 5.6, but I've tried under the latest 5.3 build of php without
success (same error).
Test script:
---------------
/* This errors */
try {
$dbh = new PDO("odbc:$host", $user, $pass );
echo "PDO_ODBC Connected<br>";
} catch (Exception $e) {
die("Unable to connect: " . $e->getMessage());
}
try {
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$fname = 'John';
$lname = 'Doe';
$sth = $dbh->prepare("insert into [User]
([TenantID],[UserID],[Email],[Active],[FirstName],[LastName]) values (9500, 3,
'test@test.com', 1, :fname, :lname)");
$sth->bindValue(':fname', $fname, PDO::PARAM_STR);
$sth->bindValue(':lname', $lname, PDO::PARAM_STR);
$sth->execute();
$count = $sth->rowCount();
echo "<br>Inserted ".$count." rows.";
$dbh->commit();
//print_r($dbh->errorInfo());
} catch (Exception $e) {
echo "<br>Failed: " . $e->getMessage();
//print_r($dbh->errorInfo(), true);
$dbh->rollBack();
}
/* This works
$con = odbc_connect($host, $user, $pass);
$stmt = odbc_prepare($con, "insert into [User]
([TenantID],[UserID],[Email],[Active],[FirstName],[LastName]) values (9500, 5,
'test@test.com', 1, ?, ?)");
$success = odbc_execute($stmt, array($fname, $lname));
echo 'Number of rows: ' . odbc_num_rows($stmt);
print_r(odbc_errormsg());
odbc_close($con);
*/
Expected result:
----------------
PDO_ODBC Connected
Inserted 1 rows.
Actual result:
--------------
Error msg:
Failed: SQLSTATE[22001]: String data, right truncated: 0 [Microsoft][ODBC Driver 11 for SQL
Server]String data, right truncation (SQLExecute[0] at
/patched-php-src-5.3.14/php-5.3.14/ext/pdo_odbc/odbc_stmt.c:254)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64828&edit=1