G gbzrope Member Licensed User Apr 3, 2019 #1 Is there any way to validate that an INSERT query was succesfull on a remote MySQL database? Other than to then run another query to retrieve the recordset created? e.g. Code: sSQL="INSERT INTO statements_collected(ID, Client, DeviceID) VALUES(" & Crsr.getint("ID") & "," & Main.iUserID & ",'" & MainOptions.sDeviceID & "')" mysql.ExecNonQuery(sSQL)
Is there any way to validate that an INSERT query was succesfull on a remote MySQL database? Other than to then run another query to retrieve the recordset created? e.g. Code: sSQL="INSERT INTO statements_collected(ID, Client, DeviceID) VALUES(" & Crsr.getint("ID") & "," & Main.iUserID & ",'" & MainOptions.sDeviceID & "')" mysql.ExecNonQuery(sSQL)
Erel B4X founder Staff member Licensed User Longtime User Apr 3, 2019 #2 1. It is a mistake to use the non-async methods with JdbcSQL. 2. Check the Success parameter. If it is true then the command was executed successfully. Upvote 0
1. It is a mistake to use the non-async methods with JdbcSQL. 2. Check the Success parameter. If it is true then the command was executed successfully.
G gbzrope Member Licensed User Apr 3, 2019 #3 Erel said: 1. It is a mistake to use the non-async methods with JdbcSQL. 2. Check the Success parameter. If it is true then the command was executed successfully. Click to expand... I tried ExecQueryAsync but that expects a recordset, this is just an Insert query, and ExecQueryAsync does not work. Upvote 0
Erel said: 1. It is a mistake to use the non-async methods with JdbcSQL. 2. Check the Success parameter. If it is true then the command was executed successfully. Click to expand... I tried ExecQueryAsync but that expects a recordset, this is just an Insert query, and ExecQueryAsync does not work.
DonManfred Expert Licensed User Longtime User Apr 3, 2019 #4 https://www.b4x.com/android/help/jdbcsql.html#jdbcsql_execnonquerybatch Code: For i = 1 To 1000 sql.AddNonQueryToBatch("INSERT INTO table1 VALUES (?)", Array(Rnd(0, 100000))) Next Dim SenderFilter As Object = sql.ExecNonQueryBatch("SQL") Wait For (SenderFilter) SQL_NonQueryComplete (Success As Boolean) Log("NonQuery: " & Success) Upvote 0
https://www.b4x.com/android/help/jdbcsql.html#jdbcsql_execnonquerybatch Code: For i = 1 To 1000 sql.AddNonQueryToBatch("INSERT INTO table1 VALUES (?)", Array(Rnd(0, 100000))) Next Dim SenderFilter As Object = sql.ExecNonQueryBatch("SQL") Wait For (SenderFilter) SQL_NonQueryComplete (Success As Boolean) Log("NonQuery: " & Success)
G gbzrope Member Licensed User Apr 3, 2019 #5 DonManfred said: https://www.b4x.com/android/help/jdbcsql.html#jdbcsql_execnonquerybatch Code: For i = 1 To 1000 sql.AddNonQueryToBatch("INSERT INTO table1 VALUES (?)", Array(Rnd(0, 100000))) Next Dim SenderFilter As Object = sql.ExecNonQueryBatch("SQL") Wait For (SenderFilter) SQL_NonQueryComplete (Success As Boolean) Log("NonQuery: " & Success) Click to expand... Yes, I have that file, the problem is/was that the queries are quite large and I have already built them up with values. I have just tried: sql.AddNonQueryToBatch(sSQL, NULL) Which seems to work. Upvote 0
DonManfred said: https://www.b4x.com/android/help/jdbcsql.html#jdbcsql_execnonquerybatch Code: For i = 1 To 1000 sql.AddNonQueryToBatch("INSERT INTO table1 VALUES (?)", Array(Rnd(0, 100000))) Next Dim SenderFilter As Object = sql.ExecNonQueryBatch("SQL") Wait For (SenderFilter) SQL_NonQueryComplete (Success As Boolean) Log("NonQuery: " & Success) Click to expand... Yes, I have that file, the problem is/was that the queries are quite large and I have already built them up with values. I have just tried: sql.AddNonQueryToBatch(sSQL, NULL) Which seems to work.
DonManfred Expert Licensed User Longtime User Apr 3, 2019 #6 ExecNonQueryBatch is async... All ok Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Apr 4, 2019 #7 Tutorial about async SQL methods: [B4X] SQL with Wait For Upvote 0