[Solar-talk] model branch: insert(), _applyFilters() & autoincrement

Rodrigo Moraes rodrigo.moraes at gmail.com
Wed Feb 21 06:54:59 PST 2007


On 2/19/07, Paul M Jones wrote:
> On Feb 19, 2007, at 9:31 AM, Paul M Jones wrote:
>
> > On Feb 17, 2007, at 10:36 AM, Rodrigo Moraes wrote:
> >
> >> In the model branch, it seems that there is a problem when you try to
> >> insert a record with an autoincremented primary key because it will
> >> not validate in _applyFilters() - there is no 'validateInt' yet for
> >> the autoincremented value.
>
> Here's something that might work; can you try it instead of the hard-
> coded value?
> [...]

It works. Solar_Sql_Adapter::lastInsertId(), however, always return 0
using MySql because of the call to _connect().

    public function lastInsertId($name = null)
    {
        // $this->_connect();
        return $this->_pdo->lastInsertId($name);
    }

Remove $this->_connect() and it will return the correct last inserted id.

rodrigo
-------------------------------
http://tipos.com.br


More information about the solar-talk mailing list