Re: [Patch] DB_DataObject and Postgres INSERT race conditionobtaininglast key

From: Date: Wed, 18 Oct 2006 07:29:08 +0000
Subject: Re: [Patch] DB_DataObject and Postgres INSERT race conditionobtaininglast key
References: 1 2 3 4 5 6 7 8  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-44617@lists.php.net to get a copy of this message
Alan Knowles wrote:
Anyways if you do the following you should already get this information: $mdb2->reverse->tableInfo($table_name);
Yes, they point was to put the code to extract that into MDB/postgres driver, rather than weighing down the more generic layers. Something like pgsql.php / override getSequenceName function getSequenceName($sqn, $col = false) {
    if ($col == false) {
        return parent::getSequenceName($sqn);
    }
    $ti = $this->reverse->tableInfo($sqn);
    ... grab the col & parse the nextval();
}
Yeah that would be doable. tableInfo() is kinda heavy though, since it calls getTableFieldDefinition() for every column. Someone should probably add a method that gets all the column definitions in a single query. But that is another story. Could you file this as a feature request? regards, Lukas

« previous php.pear.dev (#44617) next »