#1 2016-09-11 11:36:50

mingda
Member
Registered: 2013-01-04
Posts: 121

Sqlite3 db BatchInsert problem

sqlite3 db, a strange problem, from webclient, use BatchInsert, when only insert one row, in response text, can return the Insert ID, but when insert multi row, in response text, always return 0 ID

'["automaticTransactionPerRow",2147483647,"POST@test",{"ID":null,"Name":"B001","Question":"B001","Time":null}]'

return [87]

'["automaticTransactionPerRow",2147483647,"POST@test",{"ID":null,"Name":"A001","Question":"A001","Time":null},"POST@test",{"ID":null,"Name":"A002","Question":"A002","Time":null},"POST@test",{"ID":null,"Name":"A003","Question":"A003","Time":null}]'

return [0,0,0]

use version 2929

thanks

Offline

#2 2016-09-11 13:32:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: Sqlite3 db BatchInsert problem

Weird, I was not able to reproduce the issue (at least with 2936).

Which compiler are you using?

Offline

#3 2016-09-11 13:49:21

mingda
Member
Registered: 2013-01-04
Posts: 121

Re: Sqlite3 db BatchInsert problem

use DelphiXE, for multi row insert, every loop EngineAdd return 0, but for single row, return correct ID, thanks!

Offline

#4 2016-09-13 09:51:29

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: Sqlite3 db BatchInsert problem

Please enable the verbose logs and try to find out what occurred as server-side error.
I'm quite sure you will find some explicit error in the logs.

From the web client side, "ID":null and "Time":null values are IMHO incorrect.
Such fields should be just not part of the sent object.
Perhaps the null is converted into 0 on the server side...

Offline

#5 2016-09-13 10:08:40

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: Sqlite3 db BatchInsert problem

Such invalid input will now be handled as "ID":0 thanks to http://synopse.info/fossil/info/8ac7d70abc

Offline

#6 2016-09-13 13:32:30

mingda
Member
Registered: 2013-01-04
Posts: 121

Re: Sqlite3 db BatchInsert problem

The problem is indeed "ID":null caused, remove it works, I will update source to test, thank you very much!

Offline

Board footer

Powered by FluxBB