[Gambas-user] DataView Help

Gianluigi gradobag at gradobag.it
Thu Jul 13 15:46:30 CEST 2023


Il 13/07/23 15:36, Benoit Minisini ha scritto:
> Le 13/07/2023 à 15:34, Benoit Minisini a écrit :
>> Le 13/07/2023 à 15:16, Benoit Minisini a écrit :
>>> Le 13/07/2023 à 10:30, Gianluigi a écrit :
>>>> Hi Benoit,
>>>>
>>>> Sorry for the late reply, but I tried to do some testing.
>>>>
>>>> I am sure I am using the last well-compiled commit (I always delete 
>>>> the previous one).
>>>>
>>>
>>> OK, I see: it's because the student id is a serial field, so its 
>>> control has no value (it is generated by the server at insertion time).
>>>
>>> I don't think it's possible to get the last inserted record in that 
>>> case in a standard and database agnostic way... :-/
>>>
>>> There is a function that returns the last generated id in MySQL (for 
>>> example), but what if you have *two* auto increment fields in your 
>>> table?
>>>
>>
>> More info...
>>
>> Both PostgreSQL and SQLite have a RETURNING keyword that allows to 
>> return the contents of records created by an INSERT INTO statement.
>>
>> It will allow to find the newly inserted record reliably.
>>
>> Alas MySQL does not have this feature! ⁏-(
>>
>
> Good news: MariaDB implemented the RETURNING keyword on 2019.
>
> So maybe a standard solution can be implemented directly into the 
> 'gb.db' component!
>
Hi Benoit,

I will gladly wait :-)

Regards

Gianluigi



More information about the User mailing list