about 8 years ago
Suppose we have a situation like that
Here's my situation
in my php view file, I make AJAX request to the server
The AJAX request is received and runs a RAW parameterized Postgres SQL query (e.g.
DB::select('select * from my_table where id=?', array(1))
Then to solve this problem we will use such logging sql query.
if (Config::get('database.log', false))
Event::listen('illuminate.query', function($query, $bindings, $time, $name)
$data = compact('bindings', 'time', 'name');
// Format binding data for sql insertion
foreach ($bindings as $i => $binding)
if ($binding instanceof \DateTime)
$bindings[$i] = $binding->format('\'Y-m-d H:i:s\'');
else if (is_string($binding))
$bindings[$i] = "'$binding'";
// Insert bindings into query
$query = str_replace(array('%', '?'), array('%%', '%s'), $query);
$query = vsprintf($query, $bindings);
By this way we can deal with sql logging query.
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Terms of Service
| © copyright 2023 FindNerd.com. All rights reserved.
Sign up using