| @@ 105-111 (lines=7) @@ | ||
| 102 | */ |
|
| 103 | protected function formatBindings($bindings) |
|
| 104 | { |
|
| 105 | foreach ($bindings as $key => $binding) { |
|
| 106 | if ($binding instanceof DateTime) { |
|
| 107 | $bindings[$key] = $binding->format('Y-m-d H:i:s'); |
|
| 108 | } elseif (is_string($binding)) { |
|
| 109 | $bindings[$key] = str_replace("'", "\\'", $binding); |
|
| 110 | } |
|
| 111 | } |
|
| 112 | ||
| 113 | return $bindings; |
|
| 114 | } |
|
| @@ 206-212 (lines=7) @@ | ||
| 203 | } |
|
| 204 | ||
| 205 | // need to format bindings properly |
|
| 206 | foreach ($bindings as $i => $binding) { |
|
| 207 | if ($binding instanceof \DateTime) { |
|
| 208 | $bindings[$i] = $binding->format('Y-m-d H:i:s'); |
|
| 209 | } elseif (is_string($binding)) { |
|
| 210 | $bindings[$i] = str_replace("'", "\\'", $binding); |
|
| 211 | } |
|
| 212 | } |
|
| 213 | ||
| 214 | // now we create full SQL query - in case of failure, we log this |
|
| 215 | $query = str_replace(['%', '?', "\n"], ['%%', "'%s'", ' '], $query); |
|