Number of query bindValues can't be more than 1000
-
@jsulm I am using query generator that bindValue for all inserted row, for example INSERT INTO "foo_table" VALUE (foo, bar) (:foo1, bar1), (:foo2, bar2), (:foo3, bar3), ..., (:foo1000, bar1000) It is necessary for auto escaping quoted string.
-
In this case, if your driver supports it (
db->driver()->hasFeature(QSqlDriver::BatchOperations)==true
), you can use batch exec -
@VRonin Unfortunately sqlite driver not support this feature
-
Then I'd just execute multiple queries. The limit at 1000 is a limit of SQLite. the database treats multi line insert as compound select, the limit is 500 times 2 arguments per line = 1000
Nothing to do with Qt
-
@VRonin This may not be a limitation of sqlite because I can execute this query with sqlitebrowser and query.exec() with raw query but not with bindValue
-
Yet again, what's stopping you from simply running multiple queries?
-
@VRonin That's what I'm doing now
insert record one by one into the table, but it is extremely slow -
no need to do 1 by one, split it into chunks of 998 parameters
-
yes of course I do, just I want to understand why you can not bind more then 999 value?
-
@uralbash said in Number of query bindValues can't be more than 1000:
I can execute this query with [...] raw query but not with bindValue
You can build the raw query by hand anyway using QSqlDriver::formatValue to prevent injection