ZF-3116: Zend_Db_Table_Row_Abstract->save() Fail on _refresh() "Incorrect syntax near ')'"
Description
Using SQL Server 2000, and Zend_Db_Adapter_Pdo_Mssql
Here's the application code:
try
{
//$email_requests_table is an instance of a Zend_Db_Table_Abstract extension
$new = $email_requests_table->createRow(array(
'oc_id' => $input['oc_id'][$i],
'EmailAddress' => $input['EmailAddress'],
'PersonName' => $input['PersonName'],
));
$new->save();
}
catch(Zend_Db_Table_Row_Exception $e)
{
header("content-type: text/plain"); die(print_r($new, true) . "\n" . print_r($e, true));
}
Using a SQL Profiler I was able to apprehend that the correct insert is performed, but during _refresh() the following invalid query is sent: {quote} SELECT "vp_Email_Requests".* FROM "vp_Email_Requests" WHERE ("TblPK" = 181) SELECT * FROM (SELECT TOP 1 * FROM {color:red} (){color} AS inner_tbl) AS outer_tbl {quote} Which is sending an error back "Incorrect syntax near ')'" (highlighted in red)
I'm certain my application code is right, because I've done similar tasks using a MySQL adapter. I'm thinking this is a Mssql adapter related bug.
Comments
Posted by Adam VanBerlo (nix0n) on 2008-04-15T14:58:56.000+0000
This is what $email_requests_table is an instance of
Posted by Wil Sinclair (wil) on 2008-04-18T13:20:28.000+0000
Please evaluate and categorize as necessary.
Posted by Chris Dary (umbrae) on 2008-05-12T12:14:53.000+0000
It looks like this bug may be coming from line 1044 of Zend/Db/Select.php
It's calling the limit function, but passing an empty $sql variable, so the result is that the subselect is empty.
Posted by Mickael Perraud (mikaelkael) on 2008-11-03T09:23:34.000+0000
This has been fixed by SVN8784
Posted by Wil Sinclair (wil) on 2008-11-13T14:10:16.000+0000
Changing issues in preparation for the 1.7.0 release.