/** * Obtains the keys of a table using the PDO schema function. * * @param string $table * * @return array */ protected function getKeys($table, $table2 = NULL) { $pdo = $this->adapter->getDatabase()->getPDO(); $keys = $pdo->cubrid_schema(PDO::CUBRID_SCH_EXPORTED_KEYS, $table); if ($table2) { $keys = array_merge($keys, $pdo->cubrid_schema(PDO::CUBRID_SCH_IMPORTED_KEYS, $table2)); } return $keys; }
/** * @see RedBean_QueryWriter::createTable */ public function createTable($table) { $table = $this->getTableName($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 $db->setup() or * $db->selectDatabase() this method will throw an exception. * * @param boolean $tf * @param RedBean_Logger $logger * * @throws RedBean_Exception_Security */ public function debug($tf = TRUE, $logger = NULL) { if (!$logger) { $logger = new RedBean_Logger_Default(); } if (!isset($this->adapter)) { throw new RedBean_Exception_Security('Use $db->setup() first.'); } $this->adapter->getDatabase()->setDebugMode($tf, $logger); }