debug_report_bug() should be used as a replacement for app_die() calls
[mailer.git] / inc / db / lib-mysql3.php
index 4f4b8cd0989c67d6fbadf6c02a587db58927357b..25a8307ccac534ebaaaab84e705ab48712e22cc0 100644 (file)
@@ -50,7 +50,7 @@ function SQL_QUERY ($sqlString, $F, $L) {
        // Link is up?
        if (!SQL_IS_LINK_UP()) {
                // We should not quietly ignore this!
-               debug_report_bug(sprintf("Cannot query database: sqlString=%s,file=%s,line=%s",
+               debug_report_bug(__FUNCTION__, __LINE__, sprintf("Cannot query database: sqlString=%s,file=%s,line=%s",
                        $sqlString,
                        basename($F),
                        $L
@@ -60,7 +60,7 @@ function SQL_QUERY ($sqlString, $F, $L) {
                return false;
        } elseif (empty($sqlString)) {
                // Empty SQL string!
-               debug_report_bug(sprintf("SQL string is empty. Please fix this. file=%s, line=%s",
+               debug_report_bug(__FUNCTION__, __LINE__, sprintf("SQL string is empty. Please fix this. file=%s, line=%s",
                        basename($F),
                        $L
                ));
@@ -84,7 +84,7 @@ function SQL_QUERY ($sqlString, $F, $L) {
        // Run SQL command
        //* DEBUG: */ print('F=' . basename($F) . ',L=' . $L . 'sql=' . htmlentities($sqlString) . '<br />');
        $result = mysql_query($sqlString, SQL_GET_LINK())
-               or debug_report_bug('[' . __FUNCTION__ . ':' . __LINE__ . '] ' . $F . ' (' . $L . '):' . mysql_error() . "\n".
+               or debug_report_bug(__FUNCTION__, __LINE__, 'file='. $F . ',line=' . $L . ':mysql_error()=' . mysql_error() . "\n".
 'Query string:' . $sqlString);
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'sql=' . $sqlString . ',numRows=' . SQL_NUMROWS($result) . ',affected=' . SQL_AFFECTEDROWS());
 
@@ -108,7 +108,7 @@ function SQL_QUERY ($sqlString, $F, $L) {
                //
                // Debugging stuff...
                //
-               $fp = fopen(getConfig('CACHE_PATH') . 'mysql.log', 'a') or app_die(__FILE__, __LINE__, 'Cannot write mysql.log!');
+               $fp = fopen(getConfig('CACHE_PATH') . 'mysql.log', 'a') or debug_report_bug(__FUNCTION__, __LINE__, 'Cannot write mysql.log!');
                if (!isset($GLOBALS['sql_first_entry'])) {
                        // Write first entry
                        fwrite($fp, 'Module=' . getModule() . "\n");
@@ -283,7 +283,7 @@ function SQL_QUERY_ESC ($qstring, $data, $F, $L, $run=true, $strip=true, $secure
 
        // Debugging
        //
-       //* DEBUG: */ $fp = fopen(getConfig('CACHE_PATH') . 'escape_debug.log', 'a') or app_die(__FILE__, __LINE__, "Cannot write debug.log!");
+       //* DEBUG: */ $fp = fopen(getConfig('CACHE_PATH') . 'escape_debug.log', 'a') or debug_report_bug(__FUNCTION__, __LINE__, "Cannot write debug.log!");
        //* DEBUG: */ fwrite($fp, $F.'('.$L."): ".str_replace("\r", '', str_replace("\n", ' ', $eval))."\n");
        //* DEBUG: */ fclose($fp);
 
@@ -340,7 +340,7 @@ function SQL_RESULT_FROM_ARRAY ($table, $columns, $idRow, $id, $F, $L) {
        // Is columns an array?
        if (!is_array($columns)) {
                // No array
-               debug_report_bug(sprintf("columns is not an array. %s != array, file=%s, line=%s",
+               debug_report_bug(__FUNCTION__, __LINE__, sprintf("columns is not an array. %s != array, file=%s, line=%s",
                        gettype($columns),
                        basename($F),
                        $L
@@ -397,7 +397,7 @@ function SQL_ALTER_TABLE ($sql, $F, $L) {
 
                        // Get column information
                        $result = SQL_QUERY_ESC("SHOW COLUMNS FROM `%s` LIKE '%s'",
-                               array($tableName, $columnName), __FILE__, __LINE__);
+                               array($tableName, $columnName), __FUNCTION__, __LINE__);
 
                        // Do we have no entry on ADD or an entry on DROP?
                        // 123           4       4     3    3      4           4          32    23           4       4     3    3      4            4          321
@@ -444,7 +444,7 @@ function SQL_ALTER_TABLE ($sql, $F, $L) {
                } // END - if
 
                // Show indexes
-               $result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`", array($tableName), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("SHOW INDEX FROM `%s`", array($tableName), __FUNCTION__, __LINE__);
 
                // Non-skipping is default for ADD
                $skip = false;
@@ -515,7 +515,7 @@ function SQL_SET_LINK ($link) {
        // Is this a resource or null?
        if ((!is_resource($link)) && (!is_null($link))) {
                // This should never happen!
-               debug_report_bug(sprintf("link is not resource or null. Type: %s", gettype($link)));
+               debug_report_bug(__FUNCTION__, __LINE__, sprintf("link is not resource or null. Type: %s", gettype($link)));
        } // END - if
 
        // Set it