protected function createRunnableQuery($query, $bindings, $connection)
{
# add bindings to query
$bindings = $this->databaseManager->connection($connection)->prepareBindings($bindings);
foreach ($bindings as $binding) {
$binding = $this->databaseManager->connection($connection)->getPdo()->quote($binding);
$query = preg_replace('/\\?/', $binding, $query, 1);
}
# highlight keywords
$keywords = ['select', 'insert', 'update', 'delete', 'where', 'from', 'limit', 'is', 'null', 'having', 'group by', 'order by', 'asc', 'desc'];
$regexp = '/\\b' . implode('\\b|\\b', $keywords) . '\\b/i';
$query = preg_replace_callback($regexp, function ($match) {
return strtoupper($match[0]);
}, $query);
return $query;
}