ZF-3116: Zend_Db_Table_Row_Abstract->save() Fail on _refresh() "Incorrect syntax near ')'"

Issue Type: Bug Created: 2008-04-15T14:44:55.000+0000 Last Updated: 2008-11-13T14:10:16.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Adam VanBerlo (nix0n) Assignee: Mickael Perraud (mikaelkael) Tags: - Zend_Db_Table

Related issues: Attachments: - VpEmailRequests.php


Using SQL Server 2000, and Zend_Db_Adapter_Pdo_Mssql

Here's the application code:

<pre class="highlight">
    //$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'],
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.


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

<pre class="highlight">
$this->_adapter->limit('', $count, $offset)

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.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.