本文整理汇总了PHP中DatabaseBase::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseBase::__construct方法的具体用法?PHP DatabaseBase::__construct怎么用?PHP DatabaseBase::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseBase
的用法示例。
在下文中一共展示了DatabaseBase::__construct方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
/**
* Additional params include:
* - dbDirectory : directory containing the DB and the lock file directory
* [defaults to $wgSQLiteDataDir]
* - dbFilePath : use this to force the path of the DB file
* - trxMode : one of (deferred, immediate, exclusive)
* @param array $p
*/
function __construct(array $p)
{
global $wgSharedDB, $wgSQLiteDataDir;
$this->dbDir = isset($p['dbDirectory']) ? $p['dbDirectory'] : $wgSQLiteDataDir;
if (isset($p['dbFilePath'])) {
$this->mFlags = isset($p['flags']) ? $p['flags'] : 0;
// Standalone .sqlite file mode
$this->openFile($p['dbFilePath']);
// @FIXME: clean up base constructor so this can call super instead
$this->mTrxAtomicLevels = new SplStack();
} else {
$this->mDBname = $p['dbname'];
// Stock wiki mode using standard file names per DB
parent::__construct($p);
// parent doesn't open when $user is false, but we can work with $dbName
if ($p['dbname'] && !$this->isOpen()) {
if ($this->open($p['host'], $p['user'], $p['password'], $p['dbname'])) {
if ($wgSharedDB) {
$this->attachDatabase($wgSharedDB);
}
}
}
}
$this->trxMode = isset($p['trxMode']) ? strtoupper($p['trxMode']) : null;
if ($this->trxMode && !in_array($this->trxMode, array('DEFERRED', 'IMMEDIATE', 'EXCLUSIVE'))) {
$this->trxMode = null;
wfWarn("Invalid SQLite transaction mode provided.");
}
$this->lockMgr = new FSLockManager(array('lockDirectory' => "{$this->dbDir}/locks"));
}
示例2: isset
/**
* Additional params include:
* - dbDirectory : directory containing the DB and the lock file directory
* [defaults to $wgSQLiteDataDir]
* - dbFilePath : use this to force the path of the DB file
* - trxMode : one of (deferred, immediate, exclusive)
* @param array $p
*/
function __construct(array $p)
{
global $wgSharedDB, $wgSQLiteDataDir;
$this->dbDir = isset($p['dbDirectory']) ? $p['dbDirectory'] : $wgSQLiteDataDir;
if (isset($p['dbFilePath'])) {
parent::__construct($p);
// Standalone .sqlite file mode.
// Super doesn't open when $user is false, but we can work with $dbName,
// which is derived from the file path in this case.
$this->openFile($p['dbFilePath']);
} else {
$this->mDBname = $p['dbname'];
// Stock wiki mode using standard file names per DB.
parent::__construct($p);
// Super doesn't open when $user is false, but we can work with $dbName
if ($p['dbname'] && !$this->isOpen()) {
if ($this->open($p['host'], $p['user'], $p['password'], $p['dbname'])) {
if ($wgSharedDB) {
$this->attachDatabase($wgSharedDB);
}
}
}
}
$this->trxMode = isset($p['trxMode']) ? strtoupper($p['trxMode']) : null;
if ($this->trxMode && !in_array($this->trxMode, array('DEFERRED', 'IMMEDIATE', 'EXCLUSIVE'))) {
$this->trxMode = null;
wfWarn("Invalid SQLite transaction mode provided.");
}
$this->lockMgr = new FSLockManager(array('lockDirectory' => "{$this->dbDir}/locks"));
}
示例3: __construct
public function __construct($host, $user, $passwd, $database)
{
parent::__construct();
$this->m_host = $host;
$this->m_user = $user;
$this->m_passwd = $passwd;
$this->m_database = $database;
$this->m_handler = "";
}
示例4:
/**
* Constructor.
* Parameters $server, $user and $password are not used.
* @param $server string
* @param $user string
* @param $password string
* @param $dbName string
* @param $flags int
*/
function __construct( $server = false, $user = false, $password = false, $dbName = false, $flags = 0 ) {
$this->mName = $dbName;
parent::__construct( $server, $user, $password, $dbName, $flags );
// parent doesn't open when $user is false, but we can work with $dbName
if ( $dbName && !$this->isOpen() ) {
global $wgSharedDB;
if ( $this->open( $server, $user, $password, $dbName ) && $wgSharedDB ) {
$this->attachDatabase( $wgSharedDB );
}
}
}
示例5: __construct
public function __construct($host, $user, $passwd, $database)
{
parent::__construct();
$this->m_host = $host;
$this->m_user = $user;
$this->m_passwd = $passwd;
$this->m_database = $database;
$this->m_handler = "";
if (!$this->Connect()) {
die($this->m_lastError);
}
}
示例6: wfDeprecated
function __construct($p = null)
{
global $wgSharedDB, $wgSQLiteDataDir;
if (!is_array($p)) {
// legacy calling pattern
wfDeprecated(__METHOD__ . " method called without parameter array.", "1.22");
$args = func_get_args();
$p = array('host' => isset($args[0]) ? $args[0] : false, 'user' => isset($args[1]) ? $args[1] : false, 'password' => isset($args[2]) ? $args[2] : false, 'dbname' => isset($args[3]) ? $args[3] : false, 'flags' => isset($args[4]) ? $args[4] : 0, 'tablePrefix' => isset($args[5]) ? $args[5] : 'get from global', 'schema' => 'get from global', 'foreign' => isset($args[6]) ? $args[6] : false);
}
$this->mDBname = $p['dbname'];
parent::__construct($p);
// parent doesn't open when $user is false, but we can work with $dbName
if ($p['dbname'] && !$this->isOpen()) {
if ($this->open($p['host'], $p['user'], $p['password'], $p['dbname'])) {
if ($wgSharedDB) {
$this->attachDatabase($wgSharedDB);
}
}
}
$this->lockMgr = new FSLockManager(array('lockDirectory' => "{$wgSQLiteDataDir}/locks"));
}
示例7: strtoupper
function __construct($server = false, $user = false, $password = false, $dbName = false, $flags = 0, $tablePrefix = 'get from global')
{
global $wgDBprefix;
$tablePrefix = $tablePrefix == 'get from global' ? strtoupper($wgDBprefix) : strtoupper($tablePrefix);
parent::__construct($server, $user, $password, $dbName, $flags, $tablePrefix);
wfRunHooks('DatabaseOraclePostInit', array($this));
}
示例8: wfDeprecated
function __construct($p = null)
{
global $wgDBprefix;
if (!is_array($p)) {
// legacy calling pattern
wfDeprecated(__METHOD__ . " method called without parameter array.", "1.22");
$args = func_get_args();
$p = array('host' => isset($args[0]) ? $args[0] : false, 'user' => isset($args[1]) ? $args[1] : false, 'password' => isset($args[2]) ? $args[2] : false, 'dbname' => isset($args[3]) ? $args[3] : false, 'flags' => isset($args[4]) ? $args[4] : 0, 'tablePrefix' => isset($args[5]) ? $args[5] : 'get from global', 'schema' => 'get from global', 'foreign' => isset($args[6]) ? $args[6] : false);
}
if ($p['tablePrefix'] == 'get from global') {
$p['tablePrefix'] = $wgDBprefix;
}
$p['tablePrefix'] = strtoupper($p['tablePrefix']);
parent::__construct($p);
wfRunHooks('DatabaseOraclePostInit', array($this));
}
示例9: strtoupper
function __construct(array $p)
{
global $wgDBprefix;
if ($p['tablePrefix'] == 'get from global') {
$p['tablePrefix'] = $wgDBprefix;
}
$p['tablePrefix'] = strtoupper($p['tablePrefix']);
parent::__construct($p);
Hooks::run('DatabaseOraclePostInit', array($this));
}
示例10: __construct
/**
*
* @param $server String: hostname of database server
* @param $user String: username
* @param $password String: password
* @param $dbName String: database name on the server
* @param $flags Integer: database behaviour flags (optional, unused)
* @param $schema String
*/
public function __construct($server = false, $user = false, $password = false, $dbName = false, $flags = 0, $schema = self::USE_GLOBAL)
{
global $wgDBmwschema;
if ($schema == self::USE_GLOBAL) {
$this->mSchema = $wgDBmwschema;
} else {
$this->mSchema = $schema;
}
// configure the connection and statement objects
$this->setDB2Option('db2_attr_case', 'DB2_CASE_LOWER', self::CONN_OPTION | self::STMT_OPTION);
$this->setDB2Option('deferred_prepare', 'DB2_DEFERRED_PREPARE_ON', self::STMT_OPTION);
$this->setDB2Option('rowcount', 'DB2_ROWCOUNT_PREFETCH_ON', self::STMT_OPTION);
parent::__construct($server, $user, $password, $dbName, DBO_TRX | $flags);
}