Home » Database » DB » Bug #1324
DB-ODBC fails to update memo fields
Details
| Submitted | 2004-05-01 14:14 UTC |
|---|---|
| From | jchilders_98 at yahoo dot com |
| Assigned | danielc |
| Status | Bogus |
| Package | DB |
| PHP Version | 4.2.2 |
| OS | Win32 |
| Roadmaps | (Not assigned) |
Comments
[2004-05-01 14:14 UTC] jchilders_98 at yahoo dot com
Description:
------------
I am using the most current DB package available 5-1-04. Using an ODBC connection, the package fails to update memo-type fields in a Visual Foxpro database.
The code below runs without an error (outputs success message). But the value in the table is unchanged.
Reproduce code:
---------------
$sql = "UPDATE arcust$compid SET cstMemo = ? WHERE custno= ?";
$prep = $db->prepare( $sql);
$result = $db->execute($prep, array('foo!', $custno));
if (DB::isError( $result ) )
{ die( 'PearDB Execute Error: ' . $result->getDebugInfo() . "\n" . print_r( $this->dsn )); } // endif DB::isError
else { echo "<br>Memo SUPPOSEDLY updated.<br>"; print_r($result); }
Expected result:
----------------
arcust.cstMemo should now contain the value "foo!". Instead, the column remains empty.
[2004-05-01 17:36 UTC] jchilders_98 at yahoo dot com
Thanks. I am using Microsoft Visual Foxpro for the DBMS. The DSN reference a local ODBC connection to the selected Foxpro database.
Here's the code, which produces an error at the INSERT step:
// Test of memo error
require_once( "DB.php");
// First step, connect
$dsn = array(
'phptype' => 'odbc',
'username' => '',
'password' => '',
'hostspec' => 'localhost',
'database' => 'myOdbcConnection',
);
$db =& DB::connect($dsn);
$result = $db->query( "CREATE TABLE errtest (char1 C(10), memo1 M)");
if (DB::isError( $result ) )
{ die( '<br>PearDB CREATE TABLE Error: <br>Info:' . $result->getDebugInfo() . "<br>Dsn:" . print_r( $dsn )); } // endif DB::isError
$sql = "INSERT INTO errtest (memo1) VALUES (?)";
$prep = $db->Prepare( $sql);
$result = $db->Execute( $sql, "world" );
if (DB::isError( $result ) )
{ die( '<br>PearDB INSERT #1 Error: <br>Info:' . $result->getDebugInfo() . "<br>Dsn:" . print_r( $dsn )); } // endif DB::isError
$result = $db->query( "SELECT * FROM errtest");
if (DB::isError( $result ) )
{ die( '<br>PearDB SELECT Error: <br>Info:' . $result->getDebugInfo() . "<br>Dsn:" . print_r( $dsn )); } // endif DB::isError
$row = $db->fetchrow( $result);
print_r( $row);
$result = $db->query( "DROP TABLE errtest");
if (DB::isError( $result ) )
{ die( '<br>PearDB DROP TABLE Error: <br>Info:' . $result->getDebugInfo() . "<br>Dsn:" . print_r( $this->dsn )); } // endif DB::isError
[2004-05-02 12:29 UTC] jchilders_98 at yahoo dot com
Ouch! Bogus...
I will carefully review the coding standard and the Pear documentation. Apologies for chewing up some time that could have been used more productively-- tell you what, I'll owe you: let me know whenever you need some testing done (esp. re: ODBC/Foxpro) and I'll help out.
Next time I post a bug I'll make *sure* I have my ducks in a row. Dangit.