I need to execute large amount of the inserts
to the mysql table over mysql client/server protocol via prepared statement. How to do it better? Is there only one way to do it to build a query, something like this:
insert into my_table (?, ?), VALUES (1,2), (..., ...)....
and send it or maybe mysql client/server protocol support batch inserts? I've found COM_STMT_SEND_LONG_DATA in the mysql documentation, but I'm not sure that it is what i need.
I saw example on java: Java: Insert multiple rows into MySQL with PreparedStatement and there is addBatch
method. Does this method just builds one insert
request with many VALUES
clauses or it uses something from the mysql protocol?
Thank you.