Hello
On the new sugestions of adding/updating rows in a database/table i follow your code from here https://www.b4x.com/android/forum/threads/b4x-sql-with-wait-for.79532/
I have two questions:
1) IS there a possibility to return number of affected rows?
In my previouse code I did this with a globabl variable that was counting all the changes in the table1
2) if SQL_NonQueryComplete (Success As Boolean), the parameter for success is false, does this mean that no insert /update was commited to the database/table? Is this method (AddNonQueryToBatch) using some internal BeginTransaction/EndTransaction?
On the new sugestions of adding/updating rows in a database/table i follow your code from here https://www.b4x.com/android/forum/threads/b4x-sql-with-wait-for.79532/
B4X:
For i = 1 To ...
sql.AddNonQueryToBatch("INSERT INTO table1 VALUES ..."
Next
Dim SenderFilter As Object = sql.ExecNonQueryBatch("SQL")
Wait For (SenderFilter) SQL_NonQueryComplete (Success As Boolean)
Log("NonQuery: " & Success)
I have two questions:
1) IS there a possibility to return number of affected rows?
In my previouse code I did this with a globabl variable that was counting all the changes in the table1
B4X:
SQL1.BeginTransaction
Try
for i = 1 to ...
SQL1.ExecNonQuery ("INSERT INTO table1 VALUES ...")
var = var + SQL1.ExecQuerySingleResult($"SELECT changes() FROM ${table1} LIMIT 1"$)
next
SQL1.TransactionSuccessful
Catch
'the transaction will be cancelled
End Try
SQL1.EndTransaction
log("Affected rows: " & var)
2) if SQL_NonQueryComplete (Success As Boolean), the parameter for success is false, does this mean that no insert /update was commited to the database/table? Is this method (AddNonQueryToBatch) using some internal BeginTransaction/EndTransaction?