Пример #1
0
 /**
  * Builds a string version of the prepared statement
  *
  * @param   string  $query     The query string to use as the base
  * @param   array   $bindings  The bindings to interpolate in
  * @return  string
  * @since   2.0.0
  **/
 private function interpolate($query, $bindings)
 {
     $offset = 0;
     $index = 0;
     foreach (String::findLiteral('?', $query) as $placeholder) {
         $sub = is_null($bindings[$index]) ? 'NULL' : $this->quote($bindings[$index]);
         $query = substr_replace($query, $sub, $placeholder + $offset, 1);
         $offset += strlen($sub) - 1;
         $index++;
     }
     return $query;
 }