Sub LogSQL(SQL As String) As Int
Dim sSql As String
sSql="INSERT INTO SQLLog(Date,SQL,Posted) VALUES(" & Delphi.Date & ",'" & SQL.Replace("'","""") & "',0)" 'the date is only for the "log" to know when it was logged
Log(sSql)
ASQL.ExecNonQuery(sSql)
sSql="Select last_insert_rowid()"
Return ASQL.ExecQuerySingleResult(sSql)