Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-25-2008, 04:53 PM
Junior Member
 
Join Date: Mar 2008
Posts: 4
Default (Oracle) fetchrow error

ERROR:

Code:
Fatal error: Uncaught exception 'Zend_Db_Statement_Oracle_Exception' with message '933 ORA-00933: SQL command not properly ended SELECT "ALBUM".* FROM "ALBUM" WHERE ("ID" = 41) *SELECT z2.* FROM ( SELECT ROWNUM AS zend_db_rownum, z1.* FROM ( ) z1 ) z2 WHERE z2.zend_db_rownum BETWEEN 1 AND 1' in /var/www/ZendFramework/library/Zend/Db/Statement/Oracle.php:244 Stack trace: #0 /var/www/ZendFramework/library/Zend/Db/Statement.php(283): Zend_Db_Statement_Oracle->_execute(Array) #1 /var/www/ZendFramework/library/Zend/Db/Adapter/Abstract.php(406): Zend_Db_Statement->execute(Array) #2 /var/www/ZendFramework/library/Zend/Db/Table/Abstract.php(1185): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select)) #3 /var/www/ZendFramework/library/Zend/Db/Table/Abstract.php(1082): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Select)) #4 /var/www/ZendFramework/library/Zend/Db/Table/Row/Abstract.php(692): Zend_Db_Table_Abstract- in /var/www/ZendFramework/library/Zend/Db/Statement/Oracle.php on line 244
The Zend framework add "..*SELECT z2.* FROM ( SELECT ROWNUM AS zend_db_rownum, z1.* FROM ( ) z1 ) z2 WHERE..." ????


Model :

PHP Code:
class Albums extends Zend_Db_Table_Abstract
{
    protected 
$_name 'ALBUM';
    protected 
$_primary 'ID';

Function in my controller:

PHP Code:
    function deleteAction()
    {

        
$this->view->title "Supprimer l'album";
        
        
$album = new Albums();
        if (
$this->_request->isPost()) {
            
Zend_Loader::loadClass('Zend_Filter_Alpha');
            
$filter = new Zend_Filter_Alpha();
            
            
$ID = (int)$this->_request->getPost('ID');
            
$del $filter->filter($this->_request->getPost('del'));
            
            if ((
$del == 'Oui') && ($ID 0)) {
                
$where 'ID = ' $ID;
                
$rows_affected $album->delete($where);
            }
        } else {
            
            
$ID = (int)$this->_request->getParam('ID');
            if (
$ID 0) {
                
// only render if we have an id and can find the album.
                //$this->view->album = $album->fetchRow('ID='.$ID);
                
$row $album->fetchRow($album->select()->where('ID='.$ID));
                
                if (
$this->view->album->ID 0) {
                    
// render template automatically
                    
return;
                }
            }
        }
        
        
// redirect back to the album list unless we have rendered the view
        
$this->_redirect('/');        
    } 
Its the fetchrow in the ELSE is not working

Last edited by emptiness : 03-25-2008 at 04:57 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-25-2008, 05:29 PM
Junior Member
 
Join Date: Mar 2008
Posts: 5
Default

Quote:
Originally Posted by emptiness View Post
ERROR:

Code:
Fatal error: Uncaught exception 'Zend_Db_Statement_Oracle_Exception' with message '933 ORA-00933: SQL command not properly ended SELECT "ALBUM".* FROM "ALBUM" WHERE ("ID" = 41) *SELECT z2.* FROM ( SELECT ROWNUM AS zend_db_rownum, z1.* FROM ( ) z1 ) z2 WHERE z2.zend_db_rownum BETWEEN 1 AND 1' in /var/www/ZendFramework/library/Zend/Db/Statement/Oracle.php:244 Stack trace: #0 /var/www/ZendFramework/library/Zend/Db/Statement.php(283): Zend_Db_Statement_Oracle->_execute(Array) #1 /var/www/ZendFramework/library/Zend/Db/Adapter/Abstract.php(406): Zend_Db_Statement->execute(Array) #2 /var/www/ZendFramework/library/Zend/Db/Table/Abstract.php(1185): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select)) #3 /var/www/ZendFramework/library/Zend/Db/Table/Abstract.php(1082): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Select)) #4 /var/www/ZendFramework/library/Zend/Db/Table/Row/Abstract.php(692): Zend_Db_Table_Abstract- in /var/www/ZendFramework/library/Zend/Db/Statement/Oracle.php on line 244
The Zend framework add "..*SELECT z2.* FROM ( SELECT ROWNUM AS zend_db_rownum, z1.* FROM ( ) z1 ) z2 WHERE..." ????


Model :

PHP Code:
class Albums extends Zend_Db_Table_Abstract
{
    protected 
$_name 'ALBUM';
    protected 
$_primary 'ID';

Function in my controller:

PHP Code:
    function deleteAction()
    {

        
$this->view->title "Supprimer l'album";
        
        
$album = new Albums();
        if (
$this->_request->isPost()) {
            
Zend_Loader::loadClass('Zend_Filter_Alpha');
            
$filter = new Zend_Filter_Alpha();
            
            
$ID = (int)$this->_request->getPost('ID');
            
$del $filter->filter($this->_request->getPost('del'));
            
            if ((
$del == 'Oui') && ($ID 0)) {
                
$where 'ID = ' $ID;
                
$rows_affected $album->delete($where);
            }
        } else {
            
            
$ID = (int)$this->_request->getParam('ID');
            if (
$ID 0) {
                
// only render if we have an id and can find the album.
                //$this->view->album = $album->fetchRow('ID='.$ID);
                
$row $album->fetchRow($album->select()->where('ID='.$ID));
                
                if (
$this->view->album->ID 0) {
                    
// render template automatically
                    
return;
                }
            }
        }
        
        
// redirect back to the album list unless we have rendered the view
        
$this->_redirect('/');        
    } 
Its the fetchrow in the ELSE is not working
See the work code...(sorry of my bad english, I'm from russia)

Model (Schema required)

Album.php
PHP Code:
class Album extends Zend_Db_Table
{
   protected 
$_name 'BIS.ALBUM';
   protected 
$_primary 'RECID';
   protected 
$_sequence false;

MusicController.php

PHP Code:
function deleteAction()
        {
                
$this->view->title "Delete Album";
                
$album = new Album();

                if (
$this->_request->isPost()){
                        
Zend_Loader::loadClass('Zend_Filter_Alpha');
                        
$filter = new Zend_Filter_Alpha();
                        
$recid = (int)$this->_request->getPost('recid');
                        
$del $filter->filter($this->_request->getPost('del'));

                        if (
$del == 'Yes' && $recid 0) {
                                
$where 'recid=' $recid;
                                
$rows_affected $album->delete($where);
                        }
                } else {
                        
$recid = (int)$this->_request->getParam('recid');
                        if (
$recid 0) {
                                
//only render if we have an id and can find the album
                                
$this->view->album $album->fetchRow('recid=' .$recid);

                  if (
$this->view->album->RECID 0) {
                                        
// render template automatically
                                        
return;
                                }
                        }
                }

                
//redirect back to the album list unless we have rendered the view
                
$this->_redirect('/admin/music/index');
        } 
work it! of my test example.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-25-2008, 06:07 PM
Junior Member
 
Join Date: Mar 2008
Posts: 4
Default

With oracle ??


i have add :

PHP Code:
class Albums extends Zend_Db_Table_Abstract
{
    protected 
$_name 'SAGA.ALBUM';
    protected 
$_primary 'ID';
    protected 
$_sequence false
    


and not work

With a fetchall is ok!!!!!


thanks

Last edited by emptiness : 03-25-2008 at 06:44 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-26-2008, 06:00 AM
Junior Member
 
Join Date: Mar 2008
Posts: 5
Default

Quote:
Originally Posted by emptiness View Post
With oracle ??


i have add :

PHP Code:
class Albums extends Zend_Db_Table_Abstract
{
    protected 
$_name 'SAGA.ALBUM';
    protected 
$_primary 'ID';
    protected 
$_sequence false
    


and not work

With a fetchall is ok!!!!!


thanks
Yes, I'am use Oracle DB.

Why commented this??
PHP Code:
                $this->view->album $album->fetchRow('ID='.$ID); 
In
PHP Code:
($ID 0) {
                
// only render if we have an id and can find the album.
!!!             //$this->view->album = $album->fetchRow('ID='.$ID);
                
$row $album->fetchRow($album->select()->where('ID='.$ID)); 
and do it
PHP Code:
var_dump($del); var_dump($ID); and $var_dump($row); 

Last edited by michael063 : 03-26-2008 at 06:02 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-26-2008, 12:50 PM
Junior Member
 
Join Date: Mar 2008
Posts: 4
Default

Do you use the Zend Framework 1.5 ??

The comment is a test but with another line it change nothing.

In $ID is correct:

Fatal error: Uncaught exception 'Zend_Db_Statement_Oracle_Exception' with message '933 ORA-00933: SQL command not properly ended SELECT "ALBUM".* FROM "ALBUM" WHERE ("ID" = 41) *SELECT z2.* FROM ( SELECT ROWNUM AS zend_db_rownum, z1.* FROM ( ) z1 ) z2 WHERE z2.zend_db_rownum BETWEEN 1 AND 1' in /var/www/ZendFramework/library/Zend/Db/Statement/Oracle.php:244 Stack trace: #0 /var/www/ZendFramework/library/Zend/Db/Statement.php(283): Zend_Db_Statement_Oracle->_execute(Array) #1 /var/www/ZendFramework/library/Zend/Db/Adapter/Abstract.php(406): Zend_Db_Statement->execute(Array) #2 /var/www/ZendFramework/library/Zend/Db/Table/Abstract.php(1185): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select)) #3 /var/www/ZendFramework/library/Zend/Db/Table/Abstract.php(1082): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Select)) #4 /var/www/ZendFramework/library/Zend/Db/Table/Row/Abstract.php(692): Zend_Db_Table_Abstract- in /var/www/ZendFramework/libary/Zend/Db/Statement/Oracle.php on line 244


$del is null
$row is null

because the error is in the else in fechrow
No continue for print the form


In debug:

In Abstract.php the function query

$stmt = $this->prepare($sql);
the $sql is:

Code:
SELECT "ALBUM".* FROM "SAGA"."ALBUM" WHERE (ID=17) SELECT z2.*
            FROM (
                SELECT ROWNUM AS zend_db_rownum, z1.*
                FROM (
                    
                ) z1
            ) z2
            WHERE z2.zend_db_rownum BETWEEN 1 AND 1

In oracle.php

$retval = @oci_execute($this->_stmt,$this->_adapter->_getExecuteMode());

return false and error........ and go exception.....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 03-28-2008, 12:13 PM
Junior Member
 
Join Date: Mar 2008
Posts: 4
Default

Finally, my problem work with zend framework 1.5.1. The error is in zend framework 1.5


thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-29-2008, 04:06 AM
Junior Member
 
Join Date: Mar 2008
Posts: 5
Default

Quote:
Originally Posted by emptiness View Post
Finally, my problem work with zend framework 1.5.1. The error is in zend framework 1.5


thanks
Congratulations!!!!

me too this bug in my post about Db2 LIMIT/OFFSET, i'am update 1.5.1, and build valide SQL. But my DB2 is not supported this construction (between and e.t.c.).

I realize self Db2Fix class extends Zend_Db_Select
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-09-2008, 02:39 AM
Junior Member
 
Join Date: Apr 2008
Posts: 1
Default

Quote:
Originally Posted by emptiness View Post
Finally, my problem work with zend framework 1.5.1. The error is in zend framework 1.5


thanks
what is the version u're using right now that solving ur problem?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 08:16 PM.