X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fdb%2Fconnect_db.inc;h=18c27ac9f7a35c45fba64a4ba1110eb6aadfcb53;hb=e41b7b30847fa2889d67d4e418bb9819a85f065d;hp=223a37984a0bd6b3b703cfcb933a74cf77261f5b;hpb=6244828447c2feb500b7ce889db78d7bd487c23b;p=fa-stable.git
diff --git a/includes/db/connect_db.inc b/includes/db/connect_db.inc
index 223a3798..18c27ac9 100644
--- a/includes/db/connect_db.inc
+++ b/includes/db/connect_db.inc
@@ -18,7 +18,7 @@ $db_duplicate_error_code = 1062;
function db_query($sql, $err_msg=null)
{
- global $db, $show_sql;
+ global $db, $show_sql, $sql_trail, $select_trail;
//echo "
$sql
";
if ($show_sql)
@@ -28,9 +28,19 @@ function db_query($sql, $err_msg=null)
echo $sql;
echo "\n";
}
-
+
$result = mysql_query($sql, $db);
+ if($sql_trail) {
+ if ($select_trail || (strstr($sql, 'SELECT') === false)) {
+ mysql_query(
+ "INSERT INTO ".TB_PREF."sql_trail
+ (`sql`, `result`, `msg`)
+ VALUES(".db_escape($sql).",".($result ? 1 : 0).",
+ ".db_escape($err_msg).")", $db);
+ }
+ }
+
if ($err_msg != null)
if (function_exists('xdebug_call_file'))
check_db_error('
At file '.xdebug_call_file().':'.xdebug_call_line().':
'.$err_msg, $sql);