Example #1
0
 function connect($host, $db, $user, $password, $persistent = false)
 {
     parent::connect($host, $db, $user, $password, $persistent);
     $this->db =& ADONewConnection($this->_dbType);
     if ($persistent) {
         $res = $this->db->PConnect($host, $user, $password, $db);
     } else {
         $res = $this->db->Connect($host, $user, $password, $db);
     }
     return $res;
 }
Example #2
0
 function connect($host, $db, $user, $password, $persistent = false)
 {
     parent::connect($host, $db, $user, $password, $persistent);
     $dns = $this->getDbType() . "://{$user}:{$password}@{$host}/{$db}";
     $this->db = DB::connect($dns, $persistent);
     if (is_a($this->db, 'DB_Error')) {
         $this->error = $this->db->message;
         return false;
     } else {
         return true;
     }
 }
 function connect($host, $db, $user, $password, $persistent = false)
 {
     parent::connect($host, $db, $user, $password, $persistent);
     // include my extended class
     require_once 'phplib/myDB_Sql.php';
     $this->db = new myDB_Sql($host, $db, $user, $password);
     if ($persistent) {
         if (@isset($this->db->{$PConnect})) {
             $this->db->{$PConnect} = 1;
         } else {
             trigger_error('PHPLIB Version does not support persistent db connections', E_USER_WARNING);
         }
     }
     return $this->db->Link_ID == false || $this->db->Errno == null;
 }
 function connect($host, $db, $user, $password, $persistent = false)
 {
     parent::connect($host, $db, $user, $password, $persistent);
     if ($persistent) {
         $this->db = sqlite_open($db);
     } else {
         $this->db = sqlite_popen($db);
     }
     if ($this->db) {
         return true;
     } else {
         $this->error = "Error connecting to db!";
         return false;
     }
 }
 function connect($host, $db, $user, $password, $persistent = false)
 {
     parent::connect($host, $db, $user, $password, $persistent);
     $dns = "host={$host} dbname={$db} user={$user} password={$password}";
     if ($persistent) {
         $this->db = @pg_pconnect($dns);
     } else {
         $this->db = @pg_connect($dns);
     }
     if ($this->db) {
         return true;
     } else {
         $this->_addError("Error connecting to db!", 'connect()');
         return false;
     }
 }
 function connect($host, $db, $user, $password, $persistent = false)
 {
     parent::connect($host, $db, $user, $password, $persistent);
     $args = array();
     $args['Type'] = $this->_dbType;
     $args['User'] = $user;
     $args['Password'] = $password;
     $args['Host'] = $host;
     $args['Persistent'] = $persistent ? 1 : 0;
     $error = MetabaseSetupDatabase($args, $this->db);
     if ($error != null) {
         $this->error = $error;
         return false;
     } else {
         MetabaseSetDatabase($this->db, $db);
         return true;
     }
 }
Example #7
0
 function connect($host, $db, $user, $password, $persistent = false)
 {
     /*   if (!file_exists($db)) {
           return false;
        }*/
     parent::connect($host, $db, $user, $password, $persistent);
     if ($persistent) {
         $this->db = sqlite_open($db);
     } else {
         $this->db = sqlite_popen($db);
     }
     if ($this->db) {
         return true;
     } else {
         $this->_addError('Error connecting to db!', 'connect()');
         return false;
     }
 }
Example #8
0
 function connect($host, $db, $user, $password, $persistent = false)
 {
     // call parent
     parent::connect($host, $db, $user, $password, $persistent);
     // try to connect
     if ($persistent) {
         $this->db = mysql_pconnect($host, $user, $password);
     } else {
         $this->db = mysql_connect($host, $user, $password);
     }
     if ($this->db) {
         if (mysql_select_db($db, $this->db)) {
             return true;
         }
         $this->_addError(@mysql_error($this->db), 'connect()');
     }
     return false;
 }
Example #9
0
 function connect($dsn, $db = '', $user, $password, $persistent = false)
 {
     parent::connect($dsn, $db, $user, $password, $persistent);
     $this->dsn = $dsn;
     $this->host = '';
     $this->db = '';
     if ($persistent) {
         $this->db = odbc_pconnect($dsn, $user, $password);
     } else {
         $this->db = odbc_connect($dsn, $user, $password);
     }
     if ($this->db) {
         return true;
     } else {
         $this->_addError('Error connecting to db!', 'connect()');
         return false;
     }
 }
Example #10
0
 function connect($host, $db, $user, $password, $persistent = false)
 {
     parent::connect($host, $db, $user, $password, $persistent);
     $this->db = new dbx();
     return $this->query("SELECT DATABASE {$db}");
 }