/**
  * 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
0
 /**
  * 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"));
 }
 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
0
	/**
	 * 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 );
			}
		}
	}
 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
0
 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
0
 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
0
 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));
 }
 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));
 }
 /**
  *
  * @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);
 }