fix bug in chunked database access

This commit is contained in:
Kashiko Koibumi 2024-05-31 18:02:23 +09:00
parent c59b9e6df1
commit 8c85539731
No known key found for this signature in database
GPG Key ID: 8F06E069E37C40C4

View File

@ -81,9 +81,13 @@ def sqlExecuteChunked(sql_statement, as_text, idCount, *args):
i:i + sqlExecuteChunked.chunkSize - (len(args) - idCount) i:i + sqlExecuteChunked.chunkSize - (len(args) - idCount)
] ]
if as_text: if as_text:
sqlSubmitQueue.put( q = ""
sql_statement.format(','.join('CAST(? AS TEXT)' * len(chunk_slice))) n = len(chunk_slice)
) for i in range(n):
q += "CAST(? AS TEXT)"
if i != n - 1:
q += ","
sqlSubmitQueue.put(sql_statement.format(q))
else: else:
sqlSubmitQueue.put( sqlSubmitQueue.put(
sql_statement.format(','.join('?' * len(chunk_slice))) sql_statement.format(','.join('?' * len(chunk_slice)))