return $SQL;
}
+// Initializes the SQL link by bringing it up if set
+function initSqlLink () {
+ // Do this only if link is down
+ assert(!SQL_IS_LINK_UP());
+
+ // Is the configuration data set?
+ if ((!empty($GLOBALS['mysql']['host'])) && (!empty($GLOBALS['mysql']['login'])) && (!empty($GLOBALS['mysql']['dbase']))) {
+ // Remove cache
+ unset($GLOBALS['is_sql_link_up']);
+
+ // Connect to DB
+ SQL_CONNECT($GLOBALS['mysql']['host'], $GLOBALS['mysql']['login'], $GLOBALS['mysql']['password'], __FILE__, __LINE__);
+
+ // Is the link valid?
+ if (SQL_IS_LINK_UP()) {
+ // Enable exit on error
+ enableExitOnError();
+
+ // Is it a valid resource?
+ if (SQL_SELECT_DB($GLOBALS['mysql']['dbase'], __FILE__, __LINE__) === TRUE) {
+ // Set database name (required for ext-optimize and ifSqlTableExists())
+ setConfigEntry('__DB_NAME', $GLOBALS['mysql']['dbase']);
+
+ // Remove MySQL array from namespace
+ unset($GLOBALS['mysql']);
+
+ // Load cache
+ loadIncludeOnce('inc/load_cache.php');
+ } else {
+ // Wrong database?
+ reportBug(__FILE__, __LINE__, 'Wrong database selected.');
+ }
+ } else {
+ // No link to database!
+ reportBug(__FILE__, __LINE__, 'Database link is not yet up.');
+ }
+ } else {
+ // Maybe you forgot to enter your database login?
+ reportBug(__FILE__, __LINE__, 'Database login is missing.');
+ }
+}
+
+// Imports given SQL dump from given (relative) path and adds them to $sqlPool
+function importSqlDump ($path, $dumpName, $sqlPool) {
+ // Construct FQFN
+ $FQFN = getPath() . $path . '/' . $dumpName . '.sql';
+
+ // Is the file readable?
+ if (!isFileReadable($FQFN)) {
+ // Not found, which is bad
+ reportBug(__FILE__, __LINE__, sprintf("SQL dump %s/%s.sql is not readable.", $path, $dumpName));
+ } // END - if
+
+ // Then read it
+ $fileContent = readSqlDump($FQFN);
+
+ // Merge it with existing SQL statements
+ mergeSqls(explode(";\n", $fileContent), $sqlPool);
+}
+
// [EOF]
?>