I have a lot of rows to insert into a mySQL database. I would like to use a prepared statement to do the insert. Is there a way to do a multiple row insert using a prepared statement rather than iterating over all the values and doing 200K inserts? I am currently doing the latter but it is taking WAY too long. I know in PHP for instance you can pass arrays instead of single values to the prepared statement. Is anything like this possible with Xojo? I have not tried yet, thought I would ask first in case it is documented somewhere. I am not seeing it. I am pulling records from one database query and then dropping them into another database on another machine.
I am doing something like this now (slooooooow):
//Already have details from db1 in a db1RecordSet - 200K rows
//Prepare Statment for inserting into db2
Dim psM as PreparedSQLStatement = db2.Prepare("Insert into ProductDetails (SequenceNumber,ProfitCenter,AvailableQty) Values (?,?,?)")
psM.BindType(0,MySQLPreparedStatement.MYSQL_TYPE_STRING)
psM.BindType(1,MySQLPreparedStatement.MYSQL_TYPE_LONG)
psM.BindType(2,MySQLPreparedStatement.MYSQL_TYPE_LONG)
// Row by row
While Not db1RecordSet.EOF
//Insert results into db2
psM.Bind(0,db1RecordSet.Field("SEQUENC_NO").StringValue.Trim)
psM.Bind(1, db1RecordSet.Field("PROFIT_CENTER").StringValue.Trim)
psM.Bind(2, db1RecordSet.Field("AVAILABLE_QTY").DoubleValue)
psM.SQLExecute
db1RecordSet.MoveNext
Wend
db1RecordSet.Close
db2.SQLExecute("COMMIT")
What I want to do is move the execute step outside of the loop and just execute it at the end after all the values are loaded into the query. Is this possible?