Source for file OptionsDB.php
Documentation is available at OptionsDB.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// i think this class should go somewhere in a common PEAR-place,
// but since it is not very fancy to crowd the PEAR-namespace too much
// i dont know where to put it yet :-(
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Wolfram Kriesing <wolfram@kriesing.de> |
// +----------------------------------------------------------------------+
// $Id: OptionsDB.php 320703 2011-12-08 22:08:40Z danielc $
require_once 'Tree/Common.php';
* this class additionally retreives a DB connection and saves it
* @author Wolfram Kriesing <wolfram@kriesing.de>
* this constructor sets the options, since i normally need this and
* in case the constructor doesnt need to do anymore i already have
* @author Wolfram Kriesing <wolfram@kriesing.de>
* @param boolean true if loggedIn
$res = $this->_connectDB ($dsn);
if (PEAR ::isError ($res)) {
$this->dbh->setFetchmode (DB_FETCHMODE_ASSOC );
// do options afterwards since it overrules
* Connect to database by using the given DSN string
* @author copied from PEAR::Auth, Martin Jansen, slightly modified
* @param string DSN string
* @return mixed Object on error, otherwise bool
function _connectDB ($dsn)
// only include the db if one really wants to connect
// put the dsn parameters in an array
// DB would be confused with an additional URL-queries,
//like ?table=... so we do it before connecting to the DB
$dsn = DB ::parseDSN ($dsn);
$this->dbh = DB ::Connect ($dsn);
return new DB_Error ($dsn->code , PEAR_ERROR_DIE );
'The given dsn was not valid in file '.
__FILE__ . " at line " . __LINE__ ,
if (DB ::isError ($this->dbh)) {
return new DB_Error ($this->dbh->code , PEAR_ERROR_DIE );
Documentation generated on Mon, 11 Mar 2019 15:47:07 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|