X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fdb%2Fconnect_db.inc;h=3e0d551f2888beef86d29c29466e19da01c999a2;hb=bd3023c1b5e64429043358a691b3aae20eb54c09;hp=dc2dd027ede11c4aadcb1acafbed14be6c8b30fa;hpb=c3d277136992c82db575d5e38f0906625b07da2c;p=fa-stable.git
diff --git a/includes/db/connect_db.inc b/includes/db/connect_db.inc
index dc2dd027..3e0d551f 100644
--- a/includes/db/connect_db.inc
+++ b/includes/db/connect_db.inc
@@ -12,12 +12,12 @@
function set_global_connection()
{
- global $db;
+ global $db, $transaction_level;
+
+ cancel_transaction(); // cancel all aborted transactions if any
+ $transaction_level = 0;
- if (isset($_SESSION["wa_current_user"]) && $_SESSION["wa_current_user"]->company !='')
- $db = $_SESSION["wa_current_user"]->get_db_connection();
- else
- $db = null;
+ $db = $_SESSION["wa_current_user"]->get_db_connection();
}
$db_duplicate_error_code = 1062;
@@ -28,9 +28,6 @@ function db_query($sql, $err_msg=null)
{
global $db, $show_sql, $sql_trail, $select_trail, $go_debug;
- if (!$err_msg && $go_debug)
- $err_msg = "Debug mode error";
- //echo "
$sql
";
if ($show_sql)
{
echo "SQL..";
@@ -51,12 +48,13 @@ function db_query($sql, $err_msg=null)
}
}
- 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 ($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;
}
@@ -89,7 +87,7 @@ function db_free_result ($result)
mysql_free_result($result);
}
-function db_num_rows (&$result)
+function db_num_rows ($result)
{
return mysql_num_rows($result);
}
@@ -101,7 +99,8 @@ function db_num_fields ($result)
function db_escape($value = "", $nullify = false)
{
- $value = @htmlspecialchars($value, ENT_COMPAT, $_SESSION['language']->encoding);
+ $value = @html_entity_decode($value, ENT_QUOTES, $_SESSION['language']->encoding);
+ $value = @htmlspecialchars($value, ENT_QUOTES, $_SESSION['language']->encoding);
//reset default if second parameter is skipped
$nullify = ($nullify === null) ? (false) : ($nullify);