For example:
I needed to know the Master PKey of an Insert to associate all following detail records - before adding them...
B4X:
Sub ABMGenSQLInsert(SQL As SQL, Query As String, Args As List) As Int
Dim res As Int
Try
SQL.ExecNonQuery2(Query, Args)
If UsePool Then
res = SQLSelectSingleResult(SQL, "SELECT LAST_INSERT_ID()")
Else
res = SQLSelectSingleResult(SQL, "SELECT last_insert_rowid()")
End If
Catch
Log("SQL Insert: "&LastException.Message)
res = -99999999
End Try
Return res
End Sub
B4X:
This module is GOLD! Once I figured out what it was doing...