/** * @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); }
/** * 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; }
/** * Returns the current logger instance being used by the * database object. * * @return Logger */ public static function getLogger() { return self::$adapter->getDatabase()->getLogger(); }