@@ -275,14 +275,7 @@ protected function compileBinds()
275
275
{
276
276
$ sql = $ this ->finalQueryString ;
277
277
278
- $ hasBinds = strpos ($ sql , $ this ->bindMarker ) !== false ;
279
- $ hasNamedBinds = ! $ hasBinds
280
- && preg_match ('/:(?!=).+:/ ' , $ sql ) === 1 ;
281
-
282
- if (empty ($ this ->binds )
283
- || empty ($ this ->bindMarker )
284
- || (! $ hasNamedBinds && ! $ hasBinds )
285
- ) {
278
+ if (empty ($ this ->binds )) {
286
279
return ;
287
280
}
288
281
@@ -294,16 +287,25 @@ protected function compileBinds()
294
287
$ bindCount = count ($ binds );
295
288
}
296
289
297
- // Reverse the binds so that duplicate named binds
298
- // will be processed prior to the original binds.
299
- if (! is_numeric (key (array_slice ($ binds , 0 , 1 )))) {
300
- $ binds = array_reverse ($ binds );
301
- }
290
+ if (is_numeric (key (array_slice ($ binds , 0 , 1 )))) {
291
+ if (empty ($ this ->bindMarker ) || strpos ($ sql , $ this ->bindMarker ) === false ) {
292
+ return ;
293
+ }
302
294
303
- $ ml = strlen ($ this ->bindMarker );
304
- $ sql = $ hasNamedBinds ? $ this ->matchNamedBinds ($ sql , $ binds ) : $ this ->matchSimpleBinds ($ sql , $ binds , $ bindCount , $ ml );
295
+ $ ml = strlen ($ this ->bindMarker );
305
296
306
- $ this ->finalQueryString = $ sql ;
297
+ $ this ->finalQueryString = $ this ->matchSimpleBinds ($ sql , $ binds , $ bindCount , $ ml );
298
+ } else {
299
+ if (! preg_match ('/:(?!=).+:/ ' , $ sql )) {
300
+ return ;
301
+ }
302
+
303
+ // Reverse the binds so that duplicate named binds
304
+ // will be processed prior to the original binds.
305
+ $ binds = array_reverse ($ binds );
306
+
307
+ $ this ->finalQueryString = $ this ->matchNamedBinds ($ sql , $ binds );
308
+ }
307
309
}
308
310
309
311
/**
0 commit comments