S
S
samokiller2020-09-24 10:21:04
MySQL
samokiller, 2020-09-24 10:21:04

How to send several statements in one request to mysql from a c++ dll at once?

I am writing a dll in c++, vs15, mysql.h

I get records, I put them all in 1 table.
Over time, the table became too large and I decided that it was better to separate all the records by features A, B, C ... Z and add each record to its corresponding table tableA, tableB, tableC ... tableZ

However, if I sent earlier, once per second, in one query a couple of thousand records with one operator
"insert into db.table values ​​(1), (2)..."
Now you need to pre-sort the incoming data and send, conditionally, 3 operators:
"insert into db.tableA values ​​(1),(2)..."
"insert into db.tableB values ​​(1),(2)..."
"insert into db.tableC values ​​(1),(2)..."
.. "
insert into db.tableZ values ​​(1),(2)...

You can send everything inside the loop, since the amount of data is the same. But this is already Z queries, not 1.

If you try to send all Z inserts in one batch, separating ";" then the server does not accept this at all.

Question: Is it possible to somehow send insert to several tables at once in order to avoid additional load on many transactions between dll and database?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question