-function SQL_CONNECT ($host, $login, $password, $F, $L) {
- $connect = mysql_connect($host, $login, $password) or addFatalMessage($F." (".$L."):".mysql_error());
- return $connect;
+function sqlConnectToDatabase ($host, $login, $password, $file, $line) {
+ // Try to connect
+ $linkResource = mysql_connect($host, $login, $password) or sqlError($file, $line, mysql_error());
+
+ // Set the link resource
+ if (is_resource($linkResource)) {
+ /*
+ * A non-resource (boolean) may happen on installation phase which
+ * shall not be set here. Only valid link resources shall be set so
+ * isSqlLinkUp() will only return 'true' if there is really a
+ * working database link.
+ */
+ setSqlLink(__FUNCTION__, __LINE__, $linkResource);
+
+ // Init charsets (UTF-8 is default now)
+ sqlQuery("SET
+ `character_set_results`='utf8',
+ `character_set_client`='utf8',
+ `character_set_connection`='utf8',
+ `character_set_database`='utf8',
+ `character_set_server`='utf8'", __FUNCTION__, __LINE__);
+ } // END - if
+
+ // Return the resource
+ //* DEBUG: */ logDebugMessage($file . ':' . __FUNCTION__, $line . ':' . __LINE__, 'linkResource[]=' . gettype($linkResource));
+ return $linkResource;