Recent

Author Topic: [SOLVED] [LAMW] RETURNING clause with SQLite.InsertIntoTable  (Read 7472 times)

r.lukasiak

  • Full Member
  • ***
  • Posts: 138
[SOLVED] [LAMW] RETURNING clause with SQLite.InsertIntoTable
« 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?

« Last Edit: December 05, 2021, 05:00:05 am by r.lukasiak »

jmpessoa

  • Hero Member
  • *****
  • Posts: 2296
Re: [LAMW] RETURNING clause with SQLite.InsertIntoTable
« Reply #1 on: December 03, 2021, 07:08:54 pm »


Quote
is there any way to use a RETURNING clause?

No.
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

r.lukasiak

  • Full Member
  • ***
  • Posts: 138
Re: [LAMW] RETURNING clause with SQLite.InsertIntoTable
« Reply #2 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.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2296
Re: [LAMW] RETURNING clause with SQLite.InsertIntoTable
« Reply #3 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....
« Last Edit: December 04, 2021, 02:29:01 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

r.lukasiak

  • Full Member
  • ***
  • Posts: 138
Re: [LAMW] RETURNING clause with SQLite.InsertIntoTable
« Reply #4 on: December 05, 2021, 04:59:42 am »
ok, I understand. Thanks a lot!

 

TinyPortal © 2005-2018