Menu

#37 AutoExecute wrong sql (oci8po) in UPDATE

closed-fixed
nobody
None
5
2006-01-09
2005-12-13
Anonymous
No

I use AutoExecute('mytable', $arrFields, 'UPDATE',
$where); with $where="myid = 4";
And I get the following in debug :

select * from (SELECT /*+FIRST_ROWS*/* FROM mytable
WHERE myid = 4) where rownum <= ? [ (adodb_offset=>'1') ]

UPDATE mytable SET FIELD1='field1value' WHERE myid = 4)
where rownum <= ?

which is ending with a "cannot ending the sql statement"
due to the "where rownum <= ?" at the end of the UPDATE
statement, which I suspect to be erroneous here.

When I use the same arguments with Replace :
Replace('mytable', $arrFields, 'myid');
It is correct and I get in debug :

UPDATE mytable SET FIELD1='field1value',
FIELD2='field2value', FIELD3='field3value' WHERE myid = 4

So I use now the Replace instead of using AutoExecute
for both INSERT and UPDATE, but I wrote it so you can
fix it.

Frederic

Discussion

  • John Lim

    John Lim - 2006-01-09

    Logged In: YES
    user_id=724867

    Found bug. This will be fixed in 4.71. Thx.

    Added to adodb-lib.inc.php:

    else preg_match('/\s.*(\) WHERE .*)/is',
    $whereClause[1], $discard);

     
  • John Lim

    John Lim - 2006-01-09
    • status: open --> closed-fixed
     
  • David Hirst

    David Hirst - 2006-02-08

    Logged In: YES
    user_id=629564

    I have also seen this bug using oci8. I've just upgraded to
    4.71 and I am still seeing the same behavior that was
    mentioned above.

    Here is the debug output:
    UPDATE scBookmarks SET USER_ID=13, BIP='192.168.1.1',
    BSTATUS=0, BDATETIME=TO_DATE('2006-02-07','YYYY-MM-DD'),
    BMODIFIED=TO_DATE('2006-02-08','YYYY-MM-DD'),
    BTITLE='ftp://employeeshare/d/ddd/transfer/sponsor%20interaction/browser/index.htm',
    BDESCRIPTION='dhirst.com' WHERE bId=739) where rownum <=
    :adodb_offset

    Warning: ociexecute() [function.ociexecute]: OCIStmtExecute:
    ORA-00933: SQL command not properly ended in
    /usr/local/lib/php/includes/adodb-4.71/drivers/adodb-oci8.inc.php
    on line 999
    933: ORA-00933: SQL command not properly ended

    I will use replace in the meantime.

    Is there a second patch that I need to apply other than
    moving to 4.71?

    Thanks!
    -Dave Hirst

     
  • Nobody/Anonymous

    Logged In: NO

    oliver.mazariegos@gmail.com
    On nov-2007 I'm using version 5.02a and the problem has not been fixed yet, I discovered it originally in version 4.8 and was supposed to be fixed in v. 4.71

     
MongoDB Logo MongoDB