-function set_global_connection()
-{
- global $db;
-
- $db = $_SESSION["wa_current_user"]->get_db_connection();
-}
-
-$db_duplicate_error_code = 1062;
-
-//DB wrapper functions to change only once for whole application
-
-function db_query($sql, $err_msg=null)
-{
- global $db, $show_sql, $sql_trail, $select_trail, $go_debug;
-
- if ($show_sql)
- {
- echo "<font face=arial size=2 color=000099><b>SQL..</b></font>";
- echo "<pre>";
- echo $sql;
- echo "</pre>\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 || $go_debug) {
- $exit = $err_msg != null;
- if (function_exists('xdebug_call_file'))
- check_db_error('<br>At file '.xdebug_call_file().':'.xdebug_call_line().':<br>'.$err_msg, $sql, $exit);
- else
- check_db_error($err_msg, $sql, $exit);
- }
- return $result;
-}
-
-function db_fetch_row ($result)
-{
-
- return mysql_fetch_row($result);
-}
-
-function db_fetch_assoc ($result)
-{