/** * @param string $type * @param bool $writable */ public function __construct($type = null, $writable = false) { $this->writable = $writable; $this->type = $type ? $type : 'default'; $this->adapter = waDbConnector::getConnection($this->type, $this->writable); if ($this->table && !$this->fields) { $this->getMetadata(); } }
protected static function getConfig($name) { if (self::$config === null) { self::$config = waSystem::getInstance()->getConfig()->getDatabase(); } if (!isset(self::$config[$name])) { throw new waDbException(sprintf("Unknown Database Connection %s", $name)); } if (!isset(self::$config[$name]['type'])) { self::$config[$name]['type'] = function_exists('mysqli_connect') ? 'mysqli' : 'mysql'; } return self::$config[$name]; }