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