B4J Question jRDC - Returning id from record insert into a table.

vfafou

Well-Known Member
Licensed User
Longtime User
Hello!
I need to get the returning id from record insert into my database, with the use of the jRDC framework!
Does anyone have implemented this functionality?
 

vfafou

Well-Known Member
Licensed User
Longtime User
Create a Stored Procedure where you make the INSERT and after the INSERT you do a select and get the LAST_INSERT_ID and returns this.
Hello Alex!
Thank you for your response!
I'm trying to see if the answer of the httpjob returns the response with the returning id from database.
I've just added into my config file of jRDC2 the clause "returning id" at every insert statement and I'll see if it the job returns it.
 
Upvote 0

vfafou

Well-Known Member
Licensed User
Longtime User
Create a Stored Procedure where you make the INSERT and after the INSERT you do a select and get the LAST_INSERT_ID and returns this.
Another idea could be to create a stored function in the database, returning the id and get it in the app.
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Hi

You can see how to get it here

 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

vfafou

Well-Known Member
Licensed User
Longtime User
Hello! Thank you all for your responses!
I finally did it without any change!
I just do the insert with ExecuteQuery.
I have written my insert as:
B4X:
INSERT INTO table (f1,f2,f3,...)
VALUES (v1,v2,v3,...)
RETURNING id
so the DBResult is one row containing the id returned from the insert.
 
Upvote 0
Top