hi muthu,

if you read the comments of fucntion Insert_ID() in file
adodb.in.php

it writes
     /**
      * @param $table string name of the table, not needed by all 
databases (eg. mysql), default ''
      * @param $column string name of the column, not needed by all 
databases (eg. mysql), default ''
      * @return  the last inserted ID. Not all databases support this.
      */

gj.



On 2010-09-29 11:02.PD, Ap.Muthu wrote:
> The current ADOdb library is v5.11 on Care2x SVN trunk.
> It was v5.10 till about 2 to 3 weeks ago.
>
> When a record is inserted into a table, we use ADOdb's method 
> $db->Insert_ID() to get us the last inserted ID where $db is the ADOdb 
> connection object.
> The definition of the said method is in classes/adodb/adodb.inc.php files and 
> is used within ADOdb in two files:-
>      adodb-csvlib.inc.php  - Line 44:     $sql .= ','.$conn->Insert_ID();
>      adodb-perf.inc.php (for logging) - Line 107:    $conn->lastInsID = 
> @$conn->Insert_ID();
>
> The specific MySQL driver we are using here is 
> /calsses/adodb/drivers/adodb-mysq.inc.php
> The said driver has a class "mysql" that extends the base cass "ADOConnection"
> It has the class variable: var $hasInsertID = true;
> It also has a class method: _insertid()
> This method returns the last insert id and may possibly be for private use.
>
> The default class variables values in the base class ADOConnection are:
>       var $lastInsID = false;
>       var $hasInsertID = false;   /// supports autoincrement ID?
> The latter is however overridden by a re-assignment in the mysql class.
>
> The class method ADOConnection::Insert_ID() is:
>
>     function Insert_ID($table='',$column='')
>     {
>      if ($this->_logsql&&  $this->lastInsID) return $this->lastInsID;
>      if ($this->hasInsertID) return $this->_insertid($table,$column);
>      if ($this->debug) {
>       ADOConnection::outp( '<p>Insert_ID error</p>');
>       adodb_backtrace();
>      }
>      return false;
>     }
>
> > From the above it is clear that for the _insertid() to work, it should have 
> > the table name and column name provided otherwise we have to check out what 
> > defaults it will take.
>
>
> Regards,
> Ap.Muthu
>
>
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
>
>
> _______________________________________________
> Care2002-developers mailing list
> Care2002-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/care2002-developers

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Care2002-developers mailing list
Care2002-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/care2002-developers

Reply via email to