getDatabase() public method

See also: Adapter::getDatabase
public getDatabase ( )
Ejemplo n.º 1
0
 /**
  * @see QueryWriter::createTable
  */
 public function createTable($table)
 {
     $table = $this->esc($table);
     $encoding = $this->adapter->getDatabase()->getMysqlEncoding();
     $sql = "CREATE TABLE {$table} (id INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY ( id )) ENGINE = InnoDB DEFAULT CHARSET={$encoding} COLLATE={$encoding}_unicode_ci ";
     $this->adapter->exec($sql);
 }
Ejemplo n.º 2
0
 /**
  * Toggles DEBUG mode.
  * In Debug mode all SQL that happens under the hood will
  * be printed to the screen or logged by provided logger.
  * If no database connection has been configured using R::setup() or
  * R::selectDatabase() this method will throw an exception.
  * Returns the attached logger instance.
  *
  * @param boolean $tf
  * @param integer $mode (0 = to STDOUT, 1 = to ARRAY)   
  *
  * @throws Security
  * 
  * @return Logger\RDefault
  */
 public static function debug($tf = TRUE, $mode = 0)
 {
     $logger = new RDefault();
     if (!isset(self::$adapter)) {
         throw new RedException('Use R::setup() first.');
     }
     $logger->setMode($mode);
     self::$adapter->getDatabase()->setDebugMode($tf, $logger);
     return $logger;
 }
Ejemplo n.º 3
0
 /**
  * Returns the current logger instance being used by the
  * database object.
  *
  * @return Logger
  */
 public static function getLogger()
 {
     return self::$adapter->getDatabase()->getLogger();
 }