Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
problem with $dbconn->GenId(...)
  • Posted: 08.12.2005, 15:45
     
    chaKal
    rank:
    Freshman Freshman
    registered:
     July 2002
    Status:
    offline
    last visit:
    09.01.07
    Posts:
    37
    hi,

    I use Example module to write a custom module but the $dbconn->GenId(...) always returns 0 (in my module as in Example module).

    I saw a hack by Larsneo in :
    /includes/classes/adodb/drivers/adodb-mysql.inc.php
    and the explanation in:
    /includes/classes/adodb/readme_postnuke.txt

    But why using $dbconn->GenId(...) if it always return 0 ???

    I need to know the item id I insert in database. How to do that without calling GenId() ?

    chaKal
  • Posted: 10.12.2005, 04:47
     
    rank:
    Moderator Moderator
    registered:
     March 2002
    Status:
    offline
    last visit:
    26.08.08
    Posts:
    7720
    You're recommended to use this code becuase certain databases don't have auto-increment fields but use sequences instead. One example is oracle. However mysql has auto-increment fields so the GenID method of adodb has no effect when used on a mysql DB.

    If you follow the example module code further you'll see that the inserted id is calculated later using the PO_Insert_ID method.

    -Mark
  • Posted: 12.12.2005, 15:24
     
    chaKal
    rank:
    Freshman Freshman
    registered:
     July 2002
    Status:
    offline
    last visit:
    09.01.07
    Posts:
    37
    ok,
    thank mark

    chaKal

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula