[Gambas-user] gb.db local change

Benoit Minisini benoit.minisini at gambas-basic.org
Sat Dec 10 14:01:25 CET 2022


Le 10/12/2022 à 13:05, Benoit Minisini a écrit :
> This is just for your hack, as it should not be done like that:
> 
> if (!strcmp(THIS->driver->name, "postgresql"))
>    q_add(" RETURNING *");
> 
> The correct way is adding a flag in the 'flags' field of the DB_DATABASE 
> structure that tells if we can add "RETURNING", and set that flag in the 
> open_database() method of the drivers that support it (with a test on 
> the database version possibly).
> 
> Regards,
> 

Maybe that can be supported in standard. I imagine an optional boolean 
paramter to the Update() method: if set, then Update() returns a new 
'Result' object made from the result of the RETURNING clause.

Apparently RETURNING is supported by PostgreSQL, SQLite, and recent 
versions of MariaDB but just for INSERT.

Regards,

-- 
Benoît Minisini.



More information about the User mailing list