]> git.mxchange.org Git - mailer.git/blobdiff - inc/db/lib-mysql3.php
A lot fixes to templates and missing functions added, more rewrites
[mailer.git] / inc / db / lib-mysql3.php
index c98de977be81d2937759380e69ac50f6403a82c9..24e0edbb1e4ba537c05092a8841e9f93c28af0fe 100644 (file)
@@ -54,7 +54,7 @@ function SQL_QUERY ($sql_string, $F, $L) {
        // Run SQL command
        //* DEBUG: */ echo $sql_string."<br />\n";
        $result = mysql_query($sql_string, SQL_GET_LINK())
-        or addFatalMessage($F." (".$L."):".mysql_error()."<br />
+        or addFatalMessage(__FUNCTION__, __LINE__, $F." (".$L."):".mysql_error()."<br />
 Query string:<br />
 ".$sql_string);
 
@@ -180,7 +180,7 @@ function SQL_RESULT ($res, $row, $field) {
 // SQL connect
 function SQL_CONNECT ($host, $login, $password, $F, $L) {
        // Try to connect
-       $connect = mysql_connect($host, $login, $password) or addFatalMessage($F." (".$L."):".mysql_error());
+       $connect = mysql_connect($host, $login, $password) or addFatalMessage(__FUNCTION__, __LINE__, $F." (".$L."):".mysql_error());
 
        // Set the link resource
        SQL_SET_LINK($connect);
@@ -192,7 +192,7 @@ function SQL_SELECT_DB ($dbName, $F, $L) {
        if (!SQL_IS_LINK_UP()) return false;
 
        // Return the result
-       return mysql_select_db($dbName, SQL_GET_LINK()) or addFatalMessage($F." (".$L."):".mysql_error());
+       return mysql_select_db($dbName, SQL_GET_LINK()) or addFatalMessage(__FUNCTION__, __LINE__, $F." (".$L."):".mysql_error());
 }
 
 // SQL close link
@@ -213,7 +213,7 @@ function SQL_CLOSE ($F, $L) {
        } // END - if
 
        // Close database link and forget the link
-       $close = mysql_close(SQL_GET_LINK()) or addFatalMessage($F." (".$L."):".mysql_error());
+       $close = mysql_close(SQL_GET_LINK()) or addFatalMessage(__FUNCTION__, __LINE__, $F." (".$L."):".mysql_error());
 
        // Close link
        SQL_SET_LINK(null);
@@ -288,7 +288,7 @@ function SQL_INSERTID () {
 }
 
 // Escape a string for the database
-function SQL_ESCAPE ($str, $secureString=true,$strip=true) {
+function SQL_ESCAPE ($str, $secureString=true, $strip=true) {
        // Secure string first? (which is the default behaviour!)
        if ($secureString) {
                // Then do it here
@@ -385,8 +385,14 @@ function SQL_GET_LINK () {
 
 // Setter for link
 function SQL_SET_LINK ($link) {
+       // Is this a resource or null?
+       if ((!is_resource($link)) && (!is_null($link))) {
+               // This should never happen!
+               trigger_error(sprintf("link is not resource or null. Type: %s", gettype($link)));
+       } // END - if
+
        // Set it
-       $GLOABLS['sql_link'] = $link;
+       $GLOBALS['sql_link'] = $link;
 }
 
 // Checks if the link is up