This repository was archived by the owner on Aug 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +37
-14
lines changed Expand file tree Collapse file tree 3 files changed +37
-14
lines changed Original file line number Diff line number Diff line change @@ -227,10 +227,13 @@ def _compile_many(
227227 compiled = queries [0 ].compile (
228228 dialect = self ._dialect , compile_kwargs = {"render_postcompile" : True }
229229 )
230- for args in values :
231- for key , val in args .items ():
232- if key in compiled ._bind_processors :
233- args [key ] = compiled ._bind_processors [key ](val )
230+ if not isinstance (queries [0 ], DDLElement ):
231+ for args in values :
232+ for key , val in args .items ():
233+ if key in compiled ._bind_processors :
234+ args [key ] = compiled ._bind_processors [key ](val )
235+ else :
236+ values = []
234237 return compiled .string , values
235238
236239 @property
Original file line number Diff line number Diff line change @@ -272,11 +272,23 @@ def _compile_many(
272272 compiled = queries [0 ].compile (
273273 dialect = self ._dialect , compile_kwargs = {"render_postcompile" : True }
274274 )
275- for args in values :
276- for key , val in args .items ():
277- if key in compiled ._bind_processors :
278- args [key ] = compiled ._bind_processors [key ](val )
279- return compiled .string , values
275+ new_values = []
276+ if not isinstance (queries [0 ], DDLElement ):
277+ for args in values :
278+ sorted_args = sorted (args .items ())
279+ mapping = {
280+ key : "$" + str (i ) for i , (key , _ ) in enumerate (sorted_args , start = 1 )
281+ }
282+ compiled_query = compiled .string % mapping
283+ processors = compiled ._bind_processors
284+ values = [
285+ processors [key ](val ) if key in processors else val
286+ for key , val in sorted_args
287+ ]
288+ new_values .append (values )
289+ else :
290+ compiled_query = compiled .string
291+ return compiled_query , new_values
280292
281293 @staticmethod
282294 def _create_column_maps (
Original file line number Diff line number Diff line change @@ -203,11 +203,19 @@ def _compile_many(
203203 compiled = queries [0 ].compile (
204204 dialect = self ._dialect , compile_kwargs = {"render_postcompile" : True }
205205 )
206- for args in values :
207- for key , val in args .items ():
208- if key in compiled ._bind_processors :
209- args [key ] = compiled ._bind_processors [key ](val )
210- return compiled .string , values
206+ new_values = []
207+ if not isinstance (queries [0 ], DDLElement ):
208+ for args in values :
209+ temp_arr = []
210+ for key in compiled .positiontup :
211+ raw_val = args [key ]
212+ if key in compiled ._bind_processors :
213+ val = compiled ._bind_processors [key ](raw_val )
214+ else :
215+ val = raw_val
216+ temp_arr .append (val )
217+ new_values .append (temp_arr )
218+ return compiled .string , new_values
211219
212220 @property
213221 def raw_connection (self ) -> aiosqlite .core .Connection :
You can’t perform that action at this time.
0 commit comments