/** * * @param string $dbname * @param string $collection * @throws InvalidArgumentException */ public function __construct($dbname, $collection) { $this->_connectionManagement = new ConnectionManagement($dbname); if ($this->_connectionManagement->getDriver() == "mongodb") { $this->_dbDriver = new MongoDBDriver($this->_connectionManagement, $collection); } else { throw new InvalidArgumentException("There is no '{$this->_connectionManagement->getDriver()}' NoSQL database"); } }
public static function factory(ConnectionManagement $connMngt) { if (!defined('PDO::ATTR_DRIVER_NAME')) { throw new NotAvailableException("Extension 'PDO' is not loaded"); } if (!extension_loaded('pdo_' . strtolower($connMngt->getDriver()))) { throw new NotAvailableException("Extension 'pdo_" . strtolower($connMngt->getDriver()) . "' is not loaded"); } $class = '\\ByJG\\AnyDataset\\Database\\Pdo' . ucfirst($connMngt->getDriver()); if (!class_exists($class, true)) { return new DBPDODriver($connMngt, null, null, null); } else { return new $class($connMngt); } }
/** * Get a IDbFunctions class to execute Database specific operations. * @return DBFunctionsInterface */ public function getDbFunctions() { if (is_null($this->_dbFunction)) { $dbFunc = "\\ByJG\\AnyDataset\\Database\\DB" . ucfirst($this->_connectionManagement->getDriver()) . "Functions"; $this->_dbFunction = new $dbFunc(); } return $this->_dbFunction; }
/** * Each provider have your own model for pass parameter. This method define how each provider name define the parameters * * @param ConnectionManagement $connData * @return string */ public static function getParamModel(ConnectionManagement $connData) { if ($connData->getExtraParam("parammodel") != "") { return $connData->getExtraParam("parammodel"); } elseif ($connData->getDriver() == "sqlrelay") { return "?"; } else { return ":_"; } }
protected function getCommandClassName() { return "\\ByJG\\DbMigration\\Commands\\" . ucfirst($this->_connection->getDriver()) . "Command"; }
public function __construct(ConnectionManagement $connMngt) { $strcnn = $connMngt->getDriver() . ":" . $connMngt->getServer(); parent::__construct($connMngt, $strcnn, [], []); }