Example #1
0
 public function setUp()
 {
     parent::setUp();
     $dbCon = RingsideApiDbDatabase::getConnection();
     $this->assertNotNull($dbCon);
     $this->m_fqlEngine = FQLEngine::getInstance($dbCon);
 }
Example #2
0
/**
 * Create the schema for demo applications.
 * @return true/false
 */
function createDemoSchema()
{
    writeLine('Setting up DEMO tables for Tutorials.');
    $database = RingsideApiDbDatabase::getConnection();
    if ($database === false) {
        writeError('Can not connect to the database server.');
        writeError('Please check and configure your LocalSettings.php');
        writeError('Your current database information.');
        writeDatabaseInformation();
        return false;
    }
    if (!mysql_select_db(RingsideApiConfig::$db_name, $database)) {
        writeError("Can not select the database '{RingsideApiConfig::{$db_name}}'.");
    }
    $schema = readSqlFile('demo-schema.sql');
    if ($schema === false) {
        writeError('The schema \'demo-schema.sql\' could not be loaded.');
        return false;
    }
    $result = RingsideApiDbDatabase::queryMultiLine($schema, $database);
    if ($result === false) {
        writeError('The schema \'demo-schema.sql\' did not fully load, please check the error log');
        return false;
    }
    writeLine('The demo schema was loaded.');
    writeLine();
    RingsideApiDbDatabase::closeConnection($database);
    return true;
}