...I tested out with mysql client and standard call, and it worked
perfectly:

mysql> create database dropme;
Query OK, 1 row affected (0.02 sec)
mysql> \u dropme
Database changed
mysql> CREATE TABLE `care_person` (   `pid` int(11) unsigned NOT NULL
AUTO_INCREMENT,   `name` varchar(60) NOT NULL,   PRIMARY KEY (`pid`) )
ENGINE=InnoDB AUTO_INCREMENT=10000001 DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.06 sec)
mysql> insert into care_person (name) VALUES ('Donald');
Query OK, 1 row affected (0.00 sec)

mysql> SELECT LAST_INSERT_ID();
+------------------+
| LAST_INSERT_ID() |
+------------------+
|         10000001 |
+------------------+
1 row in set (0.00 sec)

That would mean as logic consequence: MySQL does not have that issue on
my ubuntu here. But the behaviour of adodb method Insert_ID() had
reproducibly that issue on the same ubuntu. Is there any reason not to
try with latest adbodb layer if that strange behaviour could be covered
with it?

Robert


Am Mittwoch, den 29.09.2010, 11:20 +0200 schrieb Gjergj Sheldija:
> 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

-- 
--
--------------------------------------------
CARE2X - free Integ Hospital Info System
https://sourceforge.net/projects/care2002/
http://www.care2x.org


------------------------------------------------------------------------------
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