Home > Back-end > Using otl_stream bulk insert data, but can only be inserted into the first
Using otl_stream bulk insert data, but can only be inserted into the first
Time:09-26
Code is roughly as follows:
# define OTL_ODBC Int main (int arg c, char * argv []) { Otl_connect dbconn (user/pw); Otl_stream otls (10, "INSERT INTO the table VALUES (: id To: value) ", dbconn); For (int index=1; The index & lt;=100; + + index) { Otls & lt; & lt; The index & lt; & lt; The index; } return 0; }
Theory when the buffer to fill, will automatically refresh and commit the transaction, namely insert 100 data, Actually committing only by inserting a, namely the values into the (1, 1), (11, 11), (21, 21)... The database version: 5.0.27, ODBC version: 5.1, engine: innodb To solve the,
CodePudding user response:
# define OTL_ODBC Int main (int arg c, char * argv []) { Otl_connect dbconn (user/pw); Otl_stream otls (10, "INSERT INTO the table VALUES (: id To: value) ", dbconn); For (int index=1; The index & lt;=100; + + index) { Otls & lt; & lt; The index & lt; & lt; The index; } return 0; }
The otl_stream otls (10, "INSERT INTO the table VALUES (: id To: value) ", dbconn); In the 10 to 1, give it a try?