Example #1
0
 /**
  * {@inheritdoc}
  *
  * @return JDatabaseDriver
  *
  * @since 1.0
  */
 protected static function createDbo()
 {
     $conf = self::getConfig();
     /** @noinspection PhpUndefinedMethodInspection */
     $host = $conf->get('host');
     /** @noinspection PhpUndefinedMethodInspection */
     $user = $conf->get('user');
     /** @noinspection PhpUndefinedMethodInspection */
     $password = $conf->get('password');
     /** @noinspection PhpUndefinedMethodInspection */
     $database = $conf->get('db');
     /** @noinspection PhpUndefinedMethodInspection */
     $prefix = $conf->get('dbprefix');
     /** @noinspection PhpUndefinedMethodInspection */
     $driver = $conf->get('dbtype');
     /** @noinspection PhpUndefinedMethodInspection */
     $debug = $conf->get('debug');
     $options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix);
     $db = null;
     try {
         NenoDatabaseDriver::clearInstances();
         $db = NenoDatabaseDriver::getInstance($options);
         $db->setDebug($debug);
     } catch (RuntimeException $ex) {
         jexit('Database Error: ' . $ex->getMessage());
     }
     return $db;
 }
Example #2
0
 /**
  * Method to clear all the instances.
  *
  * @return void
  */
 public static function clearInstances()
 {
     self::$instances = null;
 }