Lazarus

Programming => Operating Systems => Android => Topic started by: r.lukasiak on December 03, 2021, 12:41:35 am

Title: [SOLVED] [LAMW] RETURNING clause with SQLite.InsertIntoTable
Post by: r.lukasiak on December 03, 2021, 12:41:35 am
Hi everyone!

I need a RETURNING clause to get the rowid after inserting but it doesn't seem to work.
I tried
Code: Pascal  [Select][+][-]
  1. if SQL.InsertIntoTable('INSERT INTO table ... VALUES ... RETURNING rowid;') then showmessage('inserted') else showmessage('not inserted');
  2.  
but it gives me "not inserted" and SQLCursor.GetRowCount returns 0. Removing the RETURNING clause results in "inserted" so the INSERT clause itself is correct, the problem is the RETURNING clause.
I also tried to do it with ExecSQL but with the same result.

is there any way to use a RETURNING clause?

Title: Re: [LAMW] RETURNING clause with SQLite.InsertIntoTable
Post by: jmpessoa on December 03, 2021, 07:08:54 pm


Quote
is there any way to use a RETURNING clause?

No.
Title: Re: [LAMW] RETURNING clause with SQLite.InsertIntoTable
Post by: r.lukasiak on December 03, 2021, 09:52:25 pm
ok, I understand. And is there any way it will work any time in the future or it's just, for some reason, impossible?
I was combing this forum and I found out that I can use mORmot, I will give it a try meanwhile.
Title: Re: [LAMW] RETURNING clause with SQLite.InsertIntoTable
Post by: jmpessoa on December 04, 2021, 02:22:31 am
Quote
impossible?

No. but "RETURNING"  not is [yet] a SQL standard and will fail in many old android devices....
Title: Re: [LAMW] RETURNING clause with SQLite.InsertIntoTable
Post by: r.lukasiak on December 05, 2021, 04:59:42 am
ok, I understand. Thanks a lot!
TinyPortal © 2005-2018