private function registerMainDatabase()
    {
        $filename = NABU_ETC_PATH.DIRECTORY_SEPARATOR.NABU_DB_DEFAULT_FILENAME_CONFIG;
        if (!file_exists($filename) && ($file = fopen($filename, "w")) !== false) {
            fwrite($file,
                    "<?php\n".
                    "\$db_user = \"nabu-3\";\n".
                    "\$db_passwd = \"nabu-3\";\n".
                    "\$db_host = \"localhost:3306\";\n".
                    "\$db_schema = \"nabu-3\";\n".
                    "\$db_trace_query = false;\n".
                    "?>\n"
                    );
            fclose($file);
        }

        $this->main_database = new CMySQLConnector($filename);
        $this->main_database->setSpaceOptimization(true);
        if ($this->main_database->connect()) {
            if (!$this->main_database->testConnection()) {
                //throw new exceptions\ENabuCoreException(exceptions\ENabuCoreException::ERROR_M)
                $this->errorLog("Database Test error: ".$this->main_database->getLastErrorMessage());
            }
        } else {
            throw new ENabuDBException(ENabuDBException::ERROR_NOT_CONNECTED);
        }
    }
private function registerMainDatabase()
    {
        $filename = NABU_ETC_PATH.DIRECTORY_SEPARATOR.NABU_DB_DEFAULT_FILENAME_CONFIG;
        if (!file_exists($filename) && ($file = fopen($filename, "w")) !== false) {
            fwrite($file,
                    "<?php\n".
                    "\$db_user = \"nabu-3\";\n".
                    "\$db_passwd = \"nabu-3\";\n".
                    "\$db_host = \"localhost:3306\";\n".
                    "\$db_schema = \"nabu-3\";\n".
                    "\$db_trace_query = false;\n".
                    "?>\n"
                    );
            fclose($file);
        }

        $this->main_database = new CMySQLConnector($filename);
        $this->main_database->setSpaceOptimization(true);
        if ($this->main_database->connect()) {
            if (!$this->main_database->testConnection()) {
                //throw new exceptions\ENabuCoreException(exceptions\ENabuCoreException::ERROR_M)
                $this->errorLog("Database Test error: ".$this->main_database->getLastErrorMessage());
            }
        } else {
            throw new ENabuDBException(ENabuDBException::ERROR_NOT_CONNECTED);
        }
    }
private function registerMainDatabase ( ) { $ filename = NABU_ETC_PATH . DIRECTORY_SEPARATOR . NABU_DB_DEFAULT_FILENAME_CONFIG ; if ( ! file_exists ( $ filename ) && ( $ file = fopen ( $ filename , "w" ) ) !== false ) { fwrite ( $ file , "<?php\n" . "\$db_user = \"nabu-3\";\n" . "\$db_passwd = \"nabu-3\";\n" . "\$db_host = \"localhost:3306\";\n" . "\$db_schema = \"nabu-3\";\n" . "\$db_trace_query = false;\n" . "?>\n" ) ; fclose ( $ file ) ; } $ this -> main_database = new CMySQLConnector ( $ filename ) ; $ this -> main_database -> setSpaceOptimization ( true ) ; if ( $ this -> main_database -> connect ( ) ) { if ( ! $ this -> main_database -> testConnection ( ) ) { //throw new exceptions\ENabuCoreException(exceptions\ENabuCoreException::ERROR_M) $ this -> errorLog ( "Database Test error: " . $ this -> main_database -> getLastErrorMessage ( ) ) ; } } else { throw new ENabuDBException ( ENabuDBException :: ERROR_NOT_CONNECTED ) ; } }
If database configuration file does not exists then creates a default one.
Instantiate the object descriptor for main database. Assumes in this version
that the only database engine available for main storage is MySQL.
If database configuration file does not exists then creates a default one . Instantiate the object descriptor for main database . Assumes in this version that the only database engine available for main storage is MySQL .