From f9d236444fb118df31af13452ed81fbb2351150b Mon Sep 17 00:00:00 2001 From: Kashiko Koibumi Date: Fri, 31 May 2024 18:02:23 +0900 Subject: [PATCH] fix bug in chunked database access --- src/helper_sql.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/helper_sql.py b/src/helper_sql.py index cfacfde9..c5f30851 100644 --- a/src/helper_sql.py +++ b/src/helper_sql.py @@ -81,9 +81,13 @@ def sqlExecuteChunked(sql_statement, as_text, idCount, *args): i:i + sqlExecuteChunked.chunkSize - (len(args) - idCount) ] if as_text: - sqlSubmitQueue.put( - sql_statement.format(','.join('CAST(? AS TEXT)' * len(chunk_slice))) - ) + q = "" + 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: sqlSubmitQueue.put( sql_statement.format(','.join('?' * len(chunk_slice)))