(sqlStatement, idCount, *args)
| 23 | |
| 24 | |
| 25 | def sqlExecuteChunked(sqlStatement, idCount, *args): |
| 26 | # SQLITE_MAX_VARIABLE_NUMBER, |
| 27 | # unfortunately getting/setting isn't exposed to python |
| 28 | sqlExecuteChunked.chunkSize = 999 |
| 29 | |
| 30 | if idCount == 0 or idCount > len(args): |
| 31 | return 0 |
| 32 | |
| 33 | totalRowCount = 0 |
| 34 | with sqlLock: |
| 35 | for i in range( |
| 36 | len(args) - idCount, len(args), |
| 37 | sqlExecuteChunked.chunkSize - (len(args) - idCount) |
| 38 | ): |
| 39 | chunk_slice = args[ |
| 40 | i:i+sqlExecuteChunked.chunkSize - (len(args) - idCount) |
| 41 | ] |
| 42 | sqlSubmitQueue.put( |
| 43 | sqlStatement.format(','.join('?' * len(chunk_slice))) |
| 44 | ) |
| 45 | # first static args, and then iterative chunk |
| 46 | sqlSubmitQueue.put( |
| 47 | args[0:len(args)-idCount] + chunk_slice |
| 48 | ) |
| 49 | retVal = sqlReturnQueue.get() |
| 50 | totalRowCount += retVal[1] |
| 51 | sqlSubmitQueue.put('commit') |
| 52 | return totalRowCount |
| 53 | |
| 54 | |
| 55 | def sqlExecute(sqlStatement, *args): |
no test coverage detected