Android Question [SOLVED] SQL Result

makis_best

Well-Known Member
Licensed User
If I execute one SQL statement like
B4X:
SQL1 = $"DELETE FROM LOCAL_Trade WHERE Code = '${OrdersTable.GetValue(1, RowX)}'"$
No mater if the condition apply or not the command it will executed and it will complete successfully and the result will be true.

How I can know that delete actually is made.

Thank you.
 

RB Smissaert

Well-Known Member
Licensed User
If I execute one SQL statement like
B4X:
SQL1 = $"DELETE FROM LOCAL_Trade WHERE Code = '${OrdersTable.GetValue(1, RowX)}'"$
No mater if the condition apply or not the command it will executed and it will complete successfully and the result will be true.

How I can know that delete actually is made.

Thank you.
B4X:
Sub GetNumberOfChanges() As Long
 Dim strSQL As String
 Dim lRows As String
 strSQL = "SELECT changes()"
 lRows = SQL1.ExecQuerySingleResult(strSQL)
 Return lRows
End Sub

RBS
 

MarkusR

Well-Known Member
Licensed User
if it fails via try catch
B4X:
SQL1.BeginTransaction
Try
  'block of statements like:
  For i = 1 to 1000
    SQL1.ExecNonQuery("INSERT INTO table1 VALUES(...)
  Next
  SQL1.TransactionSuccessful
Catch
  Log(LastException.Message) 'no changes will be made
End Try
SQL1.EndTransaction
https://www.b4x.com/android/help/sql.html#sql_begintransaction
 

makis_best

Well-Known Member
Licensed User
I was thinking if there was a quicker way than executing before and after select count()
 
Top