Esempio n. 1
0
 /**
  * Version information about used database
  * @param bool $raw if true, only return the fetched sql_server_version
  * @return string sql server version
  */
 function sql_server_info($raw = false)
 {
     if ($this->service_handle !== false && function_exists('ibase_server_info')) {
         return @ibase_server_info($this->service_handle, IBASE_SVC_SERVER_VERSION);
     }
     return $raw ? '2.1' : 'Firebird/Interbase';
 }
Esempio n. 2
0
 /**
 +----------------------------------------------------------
 * 连接数据库方法
 +----------------------------------------------------------
 * @access public 
 +----------------------------------------------------------
 * @throws ThinkExecption
 +----------------------------------------------------------
 */
 public function connect($config = '', $linkNum = 0)
 {
     if (!isset($this->linkID[$linkNum])) {
         if (empty($config)) {
             $config = $this->config;
         }
         $conn = $this->pconnect ? 'ibase_pconnect' : 'ibase_connect';
         $this->linkID[$linkNum] = $conn($config['hostname'] . '/' . $config['hostport'] . ':' . $config['database'], $config['username'], $config['password']);
         if (!$this->linkID[$linkNum]) {
             throw_exception(ibase_errmsg());
             return False;
         }
         //剑雷 2007.12.28
         if (($svc = ibase_service_attach($config['hostname'], $config['username'], $config['password'])) != FALSE) {
             $ibase_info = ibase_server_info($svc, IBASE_SVC_SERVER_VERSION) . '/' . ibase_server_info($svc, IBASE_SVC_IMPLEMENTATION);
             ibase_service_detach($svc);
         } else {
             $ibase_info = 'Unable to Determine';
         }
         $this->dbVersion = $ibase_info;
         // 标记连接成功
         $this->connected = true;
         // 注销数据库连接配置信息
         if (1 != C('DB_DEPLOY_TYPE')) {
             unset($this->config);
         }
     }
     return $this->linkID[$linkNum];
 }
Esempio n. 3
0
 /**
  * {@inheritDoc}
  */
 public function getCurrentSchema()
 {
     if (!$this->isConnected()) {
         $this->connect();
     }
     $info = ibase_server_info($this->resource);
     die(var_dump($info));
     return isset($info->DB_NAME) ? $info->DB_NAME : '';
 }
 function connect($server, $username, $password)
 {
     $this->_link = ibase_connect($server, $username, $password);
     if ($this->_link) {
         $url_parts = explode(':', $server);
         $this->service_link = ibase_service_attach($url_parts[0], $username, $password);
         $this->server_info = ibase_server_info($this->service_link, IBASE_SVC_SERVER_VERSION);
     } else {
         $this->errno = ibase_errcode();
         $this->error = ibase_errmsg();
     }
     return (bool) $this->_link;
 }
Esempio n. 5
0
 /**
  * Database version number
  *
  * @return    string
  */
 public function version()
 {
     if (isset($this->data_cache['version'])) {
         return $this->data_cache['version'];
     }
     if ($service = ibase_service_attach($this->hostname, $this->username, $this->password)) {
         $this->data_cache['version'] = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
         // Don't keep the service open
         ibase_service_detach($service);
         return $this->data_cache['version'];
     }
     return FALSE;
 }
Esempio n. 6
0
 /**
  * Version information about used database
  * @param bool $raw if true, only return the fetched sql_server_version
  * @param bool $use_cache forced to false for Interbase
  * @return string sql server version
  */
 function sql_server_info($raw = false, $use_cache = true)
 {
     /**
      * force $use_cache false.  I didn't research why the caching code there is no caching code
      * but I assume its because the IB extension provides a direct method to access it
      * without a query.
      */
     $use_cache = false;
     if ($this->service_handle !== false && function_exists('ibase_server_info')) {
         return @ibase_server_info($this->service_handle, IBASE_SVC_SERVER_VERSION);
     }
     return $raw ? '2.1' : 'Firebird/Interbase';
 }
Esempio n. 7
0
}
?>
</td>
</tr>
<tr>
            <td class="title" colspan="2"><br />Database Connectors</td>
</tr>
<tr>
            <td class="item" colspan="2"><p>The next tests check for database support compiled with php. We use the ADODB database abstraction layer which comes with drivers for
     many databases. Consult the ADODB documentation for details. <p>For the moment only MySQL is fully supported, so you need to make sure it
     is available.</td>
</tr>
<tr>
 <td class="item"><li>iBase Support</li></td>
  <td align="left"><?php 
echo function_exists('ibase_connect') && function_exists('ibase_server_info') ? '<b class="ok">' . $okImg . '</b><span class="item"> (' . ibase_server_info() . ')</span>' : '<span class="warning">' . $failedImg . ' Not available</span>';
?>
</td>
</tr>
<tr>
 <td class="item"><li>Informix Support</li></td>
  <td align="left"><?php 
echo function_exists('ifx_connect') ? '<b class="ok">' . $okImg . '</b><span class="item"> </span>' : '<span class="warning">' . $failedImg . ' Not available</span>';
?>
</td>
</tr>
<tr>
 <td class="item"><li>LDAP Support</li></td>
  <td align="left"><?php 
echo function_exists('ldap_connect') ? '<b class="ok">' . $okImg . '</b><span class="item"> </span>' : '<span class="warning">' . $failedImg . ' Not available</span>';
?>
Esempio n. 8
0
/**
* Used to test whether we are able to connect to the database the user has specified
* and identify any problems (eg there are already tables with the names we want to use
* @param	array	$dbms should be of the format of an element of the array returned by {@link get_available_dbms get_available_dbms()}
*					necessary extensions should be loaded already
*/
function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $load_dbal = true, $unicode_check = true)
{
    global $phpbb_root_path, $phpEx, $config, $lang;
    $dbms = $dbms_details['DRIVER'];
    if ($load_dbal) {
        // Include the DB layer
        include $phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx;
    }
    // Instantiate it and set return on error true
    $sql_db = 'dbal_' . $dbms;
    $db = new $sql_db();
    $db->sql_return_on_error(true);
    // Check that we actually have a database name before going any further.....
    if ($dbms_details['DRIVER'] != 'sqlite' && $dbms_details['DRIVER'] != 'oracle' && $dbname === '') {
        $error[] = $lang['INST_ERR_DB_NO_NAME'];
        return false;
    }
    // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea
    if ($dbms_details['DRIVER'] == 'sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0) {
        $error[] = $lang['INST_ERR_DB_FORUM_PATH'];
        return false;
    }
    // Check the prefix length to ensure that index names are not too long and does not contain invalid characters
    switch ($dbms_details['DRIVER']) {
        case 'mysql':
        case 'mysqli':
            if (strspn($table_prefix, '-./\\') !== 0) {
                $error[] = $lang['INST_ERR_PREFIX_INVALID'];
                return false;
            }
            // no break;
        // no break;
        case 'postgres':
            $prefix_length = 36;
            break;
        case 'mssql':
        case 'mssql_odbc':
        case 'mssqlnative':
            $prefix_length = 90;
            break;
        case 'sqlite':
            $prefix_length = 200;
            break;
        case 'firebird':
        case 'oracle':
            $prefix_length = 6;
            break;
    }
    if (strlen($table_prefix) > $prefix_length) {
        $error[] = sprintf($lang['INST_ERR_PREFIX_TOO_LONG'], $prefix_length);
        return false;
    }
    // Try and connect ...
    if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true))) {
        $db_error = $db->sql_error();
        $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . ($db_error['message'] ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']);
    } else {
        // Likely matches for an existing phpBB installation
        if (!$prefix_may_exist) {
            $temp_prefix = strtolower($table_prefix);
            $table_ary = array($temp_prefix . 'attachments', $temp_prefix . 'config', $temp_prefix . 'sessions', $temp_prefix . 'topics', $temp_prefix . 'users');
            $tables = get_tables($db);
            $tables = array_map('strtolower', $tables);
            $table_intersect = array_intersect($tables, $table_ary);
            if (sizeof($table_intersect)) {
                $error[] = $lang['INST_ERR_PREFIX'];
            }
        }
        // Make sure that the user has selected a sensible DBAL for the DBMS actually installed
        switch ($dbms_details['DRIVER']) {
            case 'mysqli':
                if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<')) {
                    $error[] = $lang['INST_ERR_DB_NO_MYSQLI'];
                }
                break;
            case 'sqlite':
                if (version_compare(sqlite_libversion(), '2.8.2', '<')) {
                    $error[] = $lang['INST_ERR_DB_NO_SQLITE'];
                }
                break;
            case 'firebird':
                // check the version of FB, use some hackery if we can't get access to the server info
                if ($db->service_handle !== false && function_exists('ibase_server_info')) {
                    $val = @ibase_server_info($db->service_handle, IBASE_SVC_SERVER_VERSION);
                    preg_match('#V([\\d.]+)#', $val, $match);
                    if ($match[1] < 2) {
                        $error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
                    }
                    $db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES);
                    preg_match('/^\\s*Page size\\s*(\\d+)/m', $db_info, $regs);
                    $page_size = intval($regs[1]);
                    if ($page_size < 8192) {
                        $error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS'];
                    }
                } else {
                    $sql = "SELECT *\n\t\t\t\t\t\tFROM RDB{$FUNCTIONS}\n\t\t\t\t\t\tWHERE RDB{$SYSTEM_FLAG} IS NULL\n\t\t\t\t\t\t\tAND RDB{$FUNCTION_NAME} = 'CHAR_LENGTH'";
                    $result = $db->sql_query($sql);
                    $row = $db->sql_fetchrow($result);
                    $db->sql_freeresult($result);
                    // if its a UDF, its too old
                    if ($row) {
                        $error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
                    } else {
                        $sql = 'SELECT 1 FROM RDB$DATABASE
							WHERE BIN_AND(10, 1) = 0';
                        $result = $db->sql_query($sql);
                        if (!$result) {
                            $error[] = $lang['INST_ERR_DB_NO_FIREBIRD'];
                        }
                        $db->sql_freeresult($result);
                    }
                    // Setup the stuff for our random table
                    $char_array = array_merge(range('A', 'Z'), range('0', '9'));
                    $char_len = mt_rand(7, 9);
                    $char_array_len = sizeof($char_array) - 1;
                    $final = '';
                    for ($i = 0; $i < $char_len; $i++) {
                        $final .= $char_array[mt_rand(0, $char_array_len)];
                    }
                    // Create some random table
                    $sql = 'CREATE TABLE ' . $final . " (\n\t\t\t\t\t\tFIELD1 VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,\n\t\t\t\t\t\tFIELD2 INTEGER DEFAULT 0 NOT NULL);";
                    $db->sql_query($sql);
                    // Create an index that should fail if the page size is less than 8192
                    $sql = 'CREATE INDEX ' . $final . ' ON ' . $final . '(FIELD1, FIELD2);';
                    $db->sql_query($sql);
                    if (ibase_errmsg() !== false) {
                        $error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS'];
                    } else {
                        // Kill the old table
                        $db->sql_query('DROP TABLE ' . $final . ';');
                    }
                    unset($final);
                }
                break;
            case 'oracle':
                if ($unicode_check) {
                    $sql = "SELECT *\n\t\t\t\t\t\tFROM NLS_DATABASE_PARAMETERS\n\t\t\t\t\t\tWHERE PARAMETER = 'NLS_RDBMS_VERSION'\n\t\t\t\t\t\t\tOR PARAMETER = 'NLS_CHARACTERSET'";
                    $result = $db->sql_query($sql);
                    while ($row = $db->sql_fetchrow($result)) {
                        $stats[$row['parameter']] = $row['value'];
                    }
                    $db->sql_freeresult($result);
                    if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<') && $stats['NLS_CHARACTERSET'] !== 'UTF8') {
                        $error[] = $lang['INST_ERR_DB_NO_ORACLE'];
                    }
                }
                break;
            case 'postgres':
                if ($unicode_check) {
                    $sql = "SHOW server_encoding;";
                    $result = $db->sql_query($sql);
                    $row = $db->sql_fetchrow($result);
                    $db->sql_freeresult($result);
                    if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8') {
                        $error[] = $lang['INST_ERR_DB_NO_POSTGRES'];
                    }
                }
                break;
        }
    }
    if ($error_connect && (!isset($error) || !sizeof($error))) {
        return true;
    }
    return false;
}
Esempio n. 9
0
		<td class="title" colspan="3"><b>Database Connectors</b></td>
	</tr>
	<tr>
		<td class="help" colspan="3"><p>The next tests check for database support compiled with php. We use the ADODB database abstraction layer which comes with drivers for many databases. Consult the ADODB documentation for details. <p>For the moment only MySQL is fully supported, so you need to make sure it is available.</td>
	</tr>
	<tr class="second">
		<td class="item" width="220px"><li>iBase Support</li></td>
	<?php 
if (function_exists('ibase_connect') && function_exists('ibase_server_info')) {
    ?>
		<td align="left" width="16px"><?php 
    echo $okImg;
    ?>
</td>
		<td><b class="message"><span class="item">(<?php 
    echo ibase_server_info();
    ?>
)</span></b></td>
	<?php 
} else {
    ?>
		<td align="left" width="16px"><?php 
    echo $failedImg;
    ?>
</td>
		<td><span class="warning">Not available</span></td>
	<?php 
}
?>
	</tr>
	<tr class="second">
Esempio n. 10
0
 /**
  * Used to test whether we are able to connect to the database the user has specified
  * and identify any problems (eg there are already tables with the names we want to use
  * @param	array	$dbms should be of the format of an element of the array returned by {@link get_available_dbms get_available_dbms()}
  *					necessary extensions should be loaded already
  */
 function critical_connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $load_dbal = true, $unicode_check = true)
 {
     // Must be globalized here for when including the DB file
     global $phpbb_root_path, $phpEx;
     $dbms = $dbms_details['DRIVER'];
     if ($load_dbal) {
         // Include the DB layer
         include PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT;
     }
     // Instantiate it and set return on error true
     $sql_db = 'dbal_' . $dbms;
     $db = new $sql_db();
     $db->sql_return_on_error(true);
     // Check that we actually have a database name before going any further.....
     if ($dbms_details['DRIVER'] != 'sqlite' && $dbms_details['DRIVER'] != 'oracle' && $dbname === '') {
         $error[] = 'No database name specified.';
         return false;
     }
     // Check the prefix length to ensure that index names are not too long and does not contain invalid characters
     switch ($dbms_details['DRIVER']) {
         case 'mysql':
         case 'mysqli':
             if (strspn($table_prefix, '-./\\') !== 0) {
                 $error[] = 'The table prefix you have specified is invalid for your database.';
                 return false;
             }
             // no break;
         // no break;
         case 'postgres':
             $prefix_length = 36;
             break;
         case 'mssql':
         case 'mssql_odbc':
             $prefix_length = 90;
             break;
         case 'sqlite':
             $prefix_length = 200;
             break;
         case 'firebird':
         case 'oracle':
             $prefix_length = 6;
             break;
     }
     if (strlen($table_prefix) > $prefix_length) {
         $error[] = 'The table prefix you have specified is invalid for your database.';
         return false;
     }
     // Try and connect ...
     if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true))) {
         $db_error = $db->sql_error();
         $error[] = 'Could not connect to the database, see error message below.' . '<br />' . ($db_error['message'] ? $db_error['message'] : 'No error message given.');
     } else {
         // Make sure that the user has selected a sensible DBAL for the DBMS actually installed
         switch ($dbms_details['DRIVER']) {
             case 'mysqli':
                 if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<')) {
                     $error[] = 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension” option you have selected. Please try the “MySQL” option instead.';
                 }
                 break;
             case 'sqlite':
                 if (version_compare(sqlite_libversion(), '2.8.2', '<')) {
                     $error[] = 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.';
                 }
                 break;
             case 'firebird':
                 // check the version of FB, use some hackery if we can't get access to the server info
                 if ($db->service_handle !== false && function_exists('ibase_server_info')) {
                     $val = @ibase_server_info($db->service_handle, IBASE_SVC_SERVER_VERSION);
                     preg_match('#V([\\d.]+)#', $val, $match);
                     if ($match[1] < 2) {
                         $error[] = 'The version of Firebird installed on this machine is older than 2.0, please upgrade to a newer version.';
                     }
                     $db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES);
                     preg_match('/^\\s*Page size\\s*(\\d+)/m', $db_info, $regs);
                     $page_size = intval($regs[1]);
                     if ($page_size < 8192) {
                         $error[] = 'The database you selected for Firebird has a page size less than 8192, it must be at least 8192.';
                     }
                 } else {
                     $sql = "SELECT *\n\t\t\t\t\t\t\tFROM RDB{$FUNCTIONS}\n\t\t\t\t\t\t\tWHERE RDB{$SYSTEM_FLAG} IS NULL\n\t\t\t\t\t\t\t\tAND RDB{$FUNCTION_NAME} = 'CHAR_LENGTH'";
                     $result = $db->sql_query($sql);
                     $row = $db->sql_fetchrow($result);
                     $db->sql_freeresult($result);
                     // if its a UDF, its too old
                     if ($row) {
                         $error[] = 'The version of Firebird installed on this machine is older than 2.0, please upgrade to a newer version.';
                     } else {
                         $sql = "SELECT FIRST 0 char_length('')\n\t\t\t\t\t\t\t\tFROM RDB\$DATABASE";
                         $result = $db->sql_query($sql);
                         if (!$result) {
                             $error[] = 'The version of Firebird installed on this machine is older than 2.0, please upgrade to a newer version.';
                         }
                         $db->sql_freeresult($result);
                     }
                     // Setup the stuff for our random table
                     $char_array = array_merge(range('A', 'Z'), range('0', '9'));
                     $char_len = mt_rand(7, 9);
                     $char_array_len = sizeof($char_array) - 1;
                     $final = '';
                     for ($i = 0; $i < $char_len; $i++) {
                         $final .= $char_array[mt_rand(0, $char_array_len)];
                     }
                     // Create some random table
                     $sql = 'CREATE TABLE ' . $final . " (\n\t\t\t\t\t\t\tFIELD1 VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,\n\t\t\t\t\t\t\tFIELD2 INTEGER DEFAULT 0 NOT NULL);";
                     $db->sql_query($sql);
                     // Create an index that should fail if the page size is less than 8192
                     $sql = 'CREATE INDEX ' . $final . ' ON ' . $final . '(FIELD1, FIELD2);';
                     $db->sql_query($sql);
                     if (ibase_errmsg() !== false) {
                         $error[] = 'The database you selected for Firebird has a page size less than 8192, it must be at least 8192.';
                     } else {
                         // Kill the old table
                         $db->sql_query('DROP TABLE ' . $final . ';');
                     }
                     unset($final);
                 }
                 break;
             case 'oracle':
                 if ($unicode_check) {
                     $sql = "SELECT *\n\t\t\t\t\t\t\tFROM NLS_DATABASE_PARAMETERS\n\t\t\t\t\t\t\tWHERE PARAMETER = 'NLS_RDBMS_VERSION'\n\t\t\t\t\t\t\t\tOR PARAMETER = 'NLS_CHARACTERSET'";
                     $result = $db->sql_query($sql);
                     while ($row = $db->sql_fetchrow($result)) {
                         $stats[$row['parameter']] = $row['value'];
                     }
                     $db->sql_freeresult($result);
                     if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<') && $stats['NLS_CHARACTERSET'] !== 'UTF8') {
                         $error[] = 'The version of Oracle installed on this machine requires you to set the <var>NLS_CHARACTERSET</var> parameter to <var>UTF8</var>. Either upgrade your installation to 9.2+ or change the parameter.';
                     }
                 }
                 break;
             case 'postgres':
                 if ($unicode_check) {
                     $sql = "SHOW server_encoding;";
                     $result = $db->sql_query($sql);
                     $row = $db->sql_fetchrow($result);
                     $db->sql_freeresult($result);
                     if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8') {
                         $error[] = 'The database you have selected was not created in <var>UNICODE</var> or <var>UTF8</var> encoding. Try installing with a database in <var>UNICODE</var> or <var>UTF8</var> encoding.';
                     }
                 }
                 break;
         }
         $tables = get_tables($db);
         if (!in_array($table_prefix . 'acl_options', $tables) || !in_array($table_prefix . 'config', $tables) || !in_array($table_prefix . 'forums', $tables)) {
             $error[] = 'phpBB3 tables could not be found on this database with this table prefix.';
         }
     }
     if ($error_connect && empty($error)) {
         return true;
     }
     return false;
 }
Esempio n. 11
0
 /**
  * @brief DB 접속
  **/
 function _connect()
 {
     // db 정보가 없으면 무시
     if (!$this->hostname || !$this->port || !$this->userid || !$this->password || !$this->database) {
         return;
     }
     //if(strpos($this->hostname, ':')===false && $this->port) $this->hostname .= ':'.$this->port;
     // 접속시도
     $host = $this->hostname . "/" . $this->port . ":" . $this->database;
     $this->fd = @ibase_connect($host, $this->userid, $this->password);
     if (ibase_errmsg()) {
         $this->setError(ibase_errcode(), ibase_errmsg());
         return $this->is_connected = false;
     }
     // Firebird 버전 확인후 2.0 이하면 오류 표시
     if (($service = ibase_service_attach($this->hostname, $this->userid, $this->password)) != FALSE) {
         // get server version and implementation strings
         $server_info = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
         ibase_service_detach($service);
     } else {
         $this->setError(ibase_errcode(), ibase_errmsg());
         @ibase_close($this->fd);
         return $this->is_connected = false;
     }
     $pos = strpos($server_info, "Firebird");
     if ($pos !== false) {
         $ver = substr($server_info, $pos + strlen("Firebird"));
         $ver = trim($ver);
     }
     if ($ver < "2.0") {
         $this->setError(-1, "XE cannot be installed under the version of firebird 2.0. Current firebird version is " . $ver);
         @ibase_close($this->fd);
         return $this->is_connected = false;
     }
     // 접속체크
     $this->is_connected = true;
 }
Esempio n. 12
0
 /**
  * return version information about the server
  *
  * @param bool   $native  determines if the raw version string should be returned
  * @return mixed array/string with version information or MDB2 error object
  * @access public
  */
 function getServerVersion($native = false)
 {
     $server_info = false;
     if ($this->connected_server_info) {
         $server_info = $this->connected_server_info;
     } elseif ($this->options['server_version']) {
         $server_info = $this->options['server_version'];
     } else {
         $username = $this->options['DBA_username'] ? $this->options['DBA_username'] : $this->dsn['username'];
         $password = $this->options['DBA_password'] ? $this->options['DBA_password'] : $this->dsn['password'];
         $ibserv = @ibase_service_attach($this->dsn['hostspec'], $username, $password);
         $server_info = @ibase_server_info($ibserv, IBASE_SVC_SERVER_VERSION);
         @ibase_service_detach($ibserv);
     }
     if (!$server_info) {
         return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'Requires either "server_version" or "DBA_username"/"DBA_password" option', __FUNCTION__);
     }
     // cache server_info
     $this->connected_server_info = $server_info;
     if (!$native) {
         //WI-V1.5.3.4854 Firebird 1.5
         //WI-T2.1.0.16780 Firebird 2.1 Beta 2
         if (!preg_match('/-[VT]([\\d\\.]*)/', $server_info, $matches)) {
             return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'Could not parse version information:' . $server_info, __FUNCTION__);
         }
         $tmp = explode('.', $matches[1], 4);
         $server_info = array('major' => isset($tmp[0]) ? $tmp[0] : null, 'minor' => isset($tmp[1]) ? $tmp[1] : null, 'patch' => isset($tmp[2]) ? $tmp[2] : null, 'extra' => isset($tmp[3]) ? $tmp[3] : null, 'native' => $server_info);
     }
     return $server_info;
 }
Esempio n. 13
0
 /**
  * Version number query string
  *
  * @access  public
  * @return  string
  */
 function _version()
 {
     if (($svc = ibase_service_attach($this->hostname, $this->username, $this->password)) != FALSE) {
         $ibase_info = ibase_server_info($svc, IBASE_SVC_SERVER_VERSION) . '/' . ibase_server_info($svc, IBASE_SVC_IMPLEMENTATION);
         ibase_service_detach($svc);
     } else {
         $ibase_info = 'Unable to Determine';
     }
     return $ibase_info;
 }
Esempio n. 14
0
 /**
  * Retrieve server version in PHP style
  *
  * @return string
  */
 public function getServerVersion()
 {
     $this->_connect();
     $service = ibase_service_attach($this->_formatDbConnString($this->_config['host'], $this->_config['port'], ''), $this->_config['username'], $this->_config['password']);
     if ($service != FALSE) {
         $server_info = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
         ibase_service_detach($service);
         $matches = null;
         if (preg_match('/((?:[0-9]{1,2}\\.){1,3}[0-9]{1,2})/', $server_info, $matches)) {
             return $matches[1];
         } else {
             return null;
         }
     } else {
         return null;
     }
 }
Esempio n. 15
0
 /**
  * Returns the server version string.
  *
  * This function returns the version string.
  *
  * @access  public
  * @author  Thorsten Rinne <*****@*****.**>
  * @since   2005-04-16
  */
 function server_version()
 {
     return ibase_server_info();
 }
Esempio n. 16
0
 /**
  * Returns the server version string.
  * 
  * @return string
  */
 function server_version()
 {
     return ibase_server_info($this->conn);
 }