Ejemplo n.º 1
0
 public function connect()
 {
     $dsn = 'sqlsrv:Server=' . $this->_server;
     if (!empty($this->_port)) {
         $dsn .= ', ' . $this->_port;
     }
     $dsn .= '; Database=' . $this->_database;
     parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options);
     $this->_connected = true;
 }
Ejemplo n.º 2
0
    public function connect() {
      $dsn_array = array();

      if ( empty($this->_database) ) {
        $this->_database = 'postgres';
      }

      $dsn_array[] = 'dbname=' . $this->_database;

      $dsn_array[] = 'host=' . $this->_server;

      if ( !empty($this->_port) ) {
        $dsn_array[] = 'port=' . $this->_port;
      }

      $dsn = 'pgsql:' . implode(';', $dsn_array);

      $this->_connected = true;

      return parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options);
    }
Ejemplo n.º 3
0
 public function connect()
 {
     $dsn_array = array();
     if (!empty($this->_database)) {
         $dsn_array[] = 'dbname=' . $this->_database;
     }
     if (strpos($this->_server, '/') !== false || strpos($this->_server, '\\') !== false) {
         $dsn_array[] = 'unix_socket=' . $this->_server;
     } else {
         $dsn_array[] = 'host=' . $this->_server;
         if (!empty($this->_port)) {
             $dsn_array[] = 'port=' . $this->_port;
         }
     }
     $dsn = 'mysql:' . implode(';', $dsn_array);
     $this->_connected = true;
     $dbh = parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options);
     if (OSCOM::getSite() != 'Setup' && $this->_has_native_fk === false) {
         $this->setupForeignKeys();
     }
     return $dbh;
 }
Ejemplo n.º 4
0
 public function connect()
 {
     $dsn = 'sqlite:' . $this->_server;
     $this->_connected = true;
     return parent::__construct($dsn, $this->_username, $this->_password, $this->_driver_options);
 }