X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fdb%2Fconnect_db.inc;h=f91d70235fe0bb53eec1dae5182b13030f770dc2;hb=2a0f29497517eca1cde8b2832da5761edefb2268;hp=f7d214beb8b8904ccd8ed8ba8ba60370efdbaf50;hpb=39ef50319edfa2b80fdf2ec3d3b5fdb0dcbb505e;p=fa-stable.git
diff --git a/includes/db/connect_db.inc b/includes/db/connect_db.inc
index f7d214be..f91d7023 100644
--- a/includes/db/connect_db.inc
+++ b/includes/db/connect_db.inc
@@ -1,6 +1,14 @@
.
+***********************************************************************/
function set_global_connection()
{
@@ -18,8 +26,8 @@ $db_duplicate_error_code = 1062;
function db_query($sql, $err_msg=null)
{
- global $db, $show_sql;
-
+ global $db, $show_sql, $sql_trail, $select_trail, $go_debug;
+
//echo "
$sql
";
if ($show_sql)
{
@@ -28,15 +36,26 @@ function db_query($sql, $err_msg=null)
echo $sql;
echo "\n";
}
-
+
$result = mysql_query($sql, $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);
- else
- check_db_error($err_msg, $sql);
+ 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 || $go_debug) {
+ $exit = $err_msg != null;
+ if (function_exists('xdebug_call_file'))
+ check_db_error('
At file '.xdebug_call_file().':'.xdebug_call_line().':
'.$err_msg, $sql, $exit);
+ else
+ check_db_error($err_msg, $sql, $exit);
+ }
return $result;
}
@@ -46,6 +65,12 @@ function db_fetch_row ($result)
return mysql_fetch_row($result);
}
+function db_fetch_assoc ($result)
+{
+
+ return mysql_fetch_assoc($result);
+}
+
function db_fetch ($result)
{
@@ -54,7 +79,7 @@ function db_fetch ($result)
function db_seek (&$result,$record)
{
- mysql_data_seek($result, $record);
+ return mysql_data_seek($result, $record);
}
function db_free_result ($result)
@@ -75,12 +100,10 @@ function db_num_fields ($result)
function db_escape($value = "", $nullify = false)
{
- $value = @htmlspecialchars($value, ENT_COMPAT, $_SESSION['language']->encoding);
+ $value = @htmlspecialchars($value, ENT_QUOTES, $_SESSION['language']->encoding);
//reset default if second parameter is skipped
$nullify = ($nullify === null) ? (false) : ($nullify);
- //undo slashes for poorly configured servers
- $value = (get_magic_quotes_gpc()) ? (stripslashes($value)) : ($value);
//check for null/unset/empty strings
if ((!isset($value)) || (is_null($value)) || ($value === "")) {