当前位置: 首页>>代码示例>>PHP>>正文


PHP DatabaseBase::__construct方法代码示例

本文整理汇总了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"));
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:38,代码来源:DatabaseSqlite.php

示例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"));
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:38,代码来源:DatabaseSqlite.php

示例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 = "";
 }
开发者ID:prophetyang,项目名称:web-template,代码行数:9,代码来源:database_mysql.class.php

示例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 );
			}
		}
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:20,代码来源:DatabaseSqlite.php

示例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);
     }
 }
开发者ID:FantasticThought,项目名称:tfsda,代码行数:12,代码来源:database_mysqli.class.php

示例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"));
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:21,代码来源:DatabaseSqlite.php

示例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));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:DatabaseOracle.php

示例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));
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:16,代码来源:DatabaseOracle.php

示例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));
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:10,代码来源:DatabaseOracle.php

示例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);
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:23,代码来源:DatabaseIbm_db2.php


注:本文中的DatabaseBase::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。