public function execute($data = null) { if ($this->statement === false) { return false; } try { if ($data) { return $this->statement->execute($data); } return $this->statement->execute($this->dataPool); } catch (PDOException $e) { ob_start(); $this->statement->debugDumpParams(); $this->db->log('[' . $e->getMessage() . '] PDOStatementDump : ' . ob_get_clean()); return false; } }
/** * Process unpaired (no . separator) identifier. * * @param string $identifier * @param bool $table * @return string */ protected function unpaired($identifier, $table) { if ($table && !isset($this->aliases[$identifier])) { if (!isset($this->aliases[$this->prefix . $identifier])) { //Generating our alias $this->aliases[$this->prefix . $identifier] = $identifier; } $identifier = $this->prefix . $identifier; } return $this->driver->identifier($identifier); }
public static function getInstance($dsn, $user, $pass, $dbname) { if (is_null(self::$instance)) { self::$instance = new PDODriver($dsn, $user, $pass); } return self::$instance; }
/** * Returns a DSN string using the given options * * @return string DSN */ protected function getDSN() : string { // the charset option is specific to mysql return parent::getDSN() . ';charset=' . $this->options->mysql_charset; }
/** * Kickstarts RedBean :) * @param $dsn * @param $username * @param $password * @param $freeze * @param $engine * @param $debugmode * @param $unlockall * @return unknown_type */ public static function kickstart($dsn = "mysql:host=localhost;dbname=oodb", $username = '******', $password = '', $freeze = false, $engine = "innodb", $debugmode = false, $unlockall = false) { //This is no longer configurable eval("\n\t\t\tclass R extends RedBean_OODB { }\n\t\t"); eval("\n\t\t\tclass RD extends RedBean_Decorator { }\n\t\t"); //get an instance of the MySQL database $db = PDODriver::getInstance($dsn, $username, $password, null); if ($debugmode) { $db->setDebugMode(1); } RedBean_OODB::$db = new RedBean_DBAdapter($db); //Wrap ADO in RedBean's adapter RedBean_OODB::setEngine($engine); //select a database driver RedBean_OODB::init(); //Init RedBean if ($unlockall) { RedBean_OODB::resetAll(); //Release all locks } if ($freeze) { RedBean_OODB::freeze(); //Decide whether to freeze the database } }