コード例 #1
0
 /**
  * Create a new MySQL back-end driver
  * 
  * @param string $dsn		A DSN-style connection string (i.e.: "mysql://*****:*****@your-mysql-host:port/your-mysql-database")
  * @param array $config		Configuration options for the driver (not currently supported)
  */
 public function __construct($dsn_or_conn, $config)
 {
     $config = $this->_defaults($config);
     $this->_log_level = (int) $config['log_level'];
     if (is_resource($dsn_or_conn)) {
         $this->_conn = $dsn_or_conn;
     } else {
         $defaults = array('scheme' => 'mysql', 'host' => 'localhost', 'port' => 3306, 'user' => 'root', 'pass' => '', 'path' => '/quickbooks');
         $parse = QuickBooks_Utilities::parseDSN($dsn_or_conn, $defaults);
         $this->_connect($parse['host'], $parse['port'], $parse['user'], $parse['pass'], substr($parse['path'], 1), $config['new_link'], $config['client_flags']);
     }
     // Call the parent constructor too
     parent::__construct($dsn_or_conn, $config);
 }
コード例 #2
0
ファイル: Sqlite.php プロジェクト: djeraseit/quickbooks-php
 /**
  * Create a new MySQL back-end driver
  *
  * @param string $dsn		A DSN-style connection string (i.e.: "mysql://*****:*****@your-mysql-host:port/your-mysql-database")
  * @param array $config		Configuration options for the driver (not currently supported)
  */
 public function __construct($dsn_or_conn, $config)
 {
     $config = $this->_defaults($config);
     $this->_log_level = (int) $config['log_level'];
     if (is_resource($dsn_or_conn)) {
         $this->_conn = $dsn_or_conn;
     } else {
         $trim = false;
         if (false === strpos($dsn_or_conn, ':///')) {
             $dsn_or_conn = str_replace('://', '://localhost/', $dsn_or_conn);
             $trim = true;
         }
         $defaults = array('scheme' => 'mysql', 'host' => 'localhost', 'port' => 3306, 'user' => 'root', 'pass' => '', 'path' => '/quickbooks');
         $parse = QuickBooks_Utilities::parseDSN($dsn_or_conn, $defaults);
         if ($trim) {
             $parse['path'] = substr($parse['path'], 1);
         }
         //print_r($parse);
         //exit;
         $this->_connect($parse['host'], $parse['port'], $parse['user'], $parse['pass'], $parse['path'], $config['new_link'], $config['client_flags']);
     }
     // Call the parent constructor too
     parent::__construct($dsn_or_conn, $config);
 }