function navi() { global $SIDU; $conn = $SIDU['conn'][$SIDU[0]]; $link = @explode(',', $_GET['id']); $eng = @array('my' => 'MySQL', 'pg' => 'Postgres', 'sl' => 'SQLite'); @sidu_sort($SIDU[5], $SIDU[6], $SIDU[7], $SIDU['page']['sortObj']); $obj = @array("r" => @lang(1416), "v" => @lang(1417), "S" => @lang(1418), "f" => @lang(1419)); if ($link[3] != '') { if ($link[3] == 'r') { echo "<a href='tab-new.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']},{$SIDU['3']},{$SIDU['4']},{$SIDU['5']},{$SIDU['6']}' onclick=\"xwin(this.href,700,500);return false\" ", @html_hkey("=", @lang(1401)), ">", @html_img('img/tool-add'), "</a>{$SIDU['sep']}"; } if ($link[3] == 'r' || $link[3] == 'v') { echo "<a href='#' ", @html_hkey("E", @lang(1402)), " onclick='dbexp(\"{$SIDU['0']},{$SIDU['1']},{$SIDU['2']},{$SIDU['3']}\",\"objs[]\")'>", @html_img('img/tool-down'), $SIDU['page']['menuText'] ? @lang(1403) : "", "</a>"; } if ($link[3] == 'r') { echo " <a href='imp.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']}' ", @html_hkey("I", @lang(1404)), " onclick='xwin(this.href);return false'>", @html_img('img/tool-imp'), $SIDU['page']['menuText'] ? @lang(1405) : "", "</a>"; } if ($link[3] == 'r') { echo " <a href='#' onclick=\"showHide('objTool')\" title='", @lang(1406), "'>", @html_img('img/tool-sys'), $SIDU['page']['menuText'] ? @lang(1407) : "", "</a>\n\t\t\t<a href='#' onclick=\"setv('objcmd','Empty');return (confirm('", @lang(1409), "') ? dataTab.submit() : false)\" ", @html_hkey("-", @lang(1410)), ">", @html_img('img/tool-flush'), $SIDU['page']['menuText'] ? @lang(1408) : "", "</a>"; } echo " <a href='#' onclick=\"setv('objcmd','Drop'); return (confirm('", @lang(1412, $obj[$SIDU[3]]), "') ? dataTab.submit() : false)\" ", @html_hkey("X", @lang(1413)), ">", @html_img('img/tool-x'), $SIDU['page']['menuText'] ? @lang(1411) : "", "</a>\n\t\t\t<a href='" . ($conn[1] == "sl" ? "tab.php?id={$SIDU['0']},{$SIDU['1']},0,r,sqlite_master'" : "#' onclick=\"showHide('DBseek')\"") . " ", @html_hkey("F", @lang(1414)), ">", @html_img('img/tool-find'), $SIDU['page']['menuText'] ? @lang(1415) : "", "</a>{$SIDU['sep']}", @html_img("img/x{$link['3']}"), " <a href='db.php?id={$link['0']},{$link['1']},,,,{$SIDU['5']},{$SIDU['6']}'>{$link['1']}</a>", $link[2] ? " » <a href='db.php?id={$link['0']},{$link['1']},{$link['2']},{$link['3']},,{$SIDU['5']},{$SIDU['6']}'>{$link['2']}</a>" : "", $link[4] != '' ? " » {$link['4']}" : ""; } else { if ($conn[1] == "my") { $serv['server'] = @mysql_get_server_info(); } elseif ($conn[1] == "pg") { $serv = @pg_version(); } else { $serv['server'] = @sqlite_libversion(); } echo @html_img("img/eng-{$conn['1']}"), " <b>SIDU 3.0</b> for <b>{$eng[$conn[1]]}</b>\n\t\t{$SIDU['sep']}<a href='" . ($conn[1] == "sl" ? "tab.php?id={$SIDU['0']},{$SIDU['1']},0,r,sqlite_master'" : "#' onclick=\"showHide('DBseek')\"") . " ", @html_hkey("F", @lang(1414)), @html_img('img/tool-find'), "</a>\n\t\t<a href='db.php?id={$link['0']},,,,,{$SIDU['5']},{$SIDU['6']}'><b>", $conn[1] == "sl" ? "SQLite" : "{$conn['3']}@{$conn['2']}", "</b></a> v {$serv['server']}\n\t\t{$SIDU['sep']} ", @date("Y-m-d H:i:s"); } }
function ServerInfo() { $arr['version'] = sqlite_libversion(); $arr['description'] = 'SQLite '; $arr['encoding'] = sqlite_libencoding(); return $arr; }
function AlterTable(&$db, $name, &$changes, $check) { $sql = array(); if (isset($changes["name"])) { $new_name = $changes["name"]; $sql[] = "ALTER TABLE " . $name . " RENAME TO " . $new_name; } else { $new_name = $name; } if (isset($changes["AddedFields"])) { $fields = $changes["AddedFields"]; for ($field = 0, Reset($fields); $field < count($fields); Next($fields), $field++) { $field_name = Key($fields); $definition = $fields[$field_name]; if (!$this->GetField($db, $definition, $field_name, $declaration)) { return 0; } $sql[] = "ALTER TABLE " . $new_name . " ADD COLUMN " . $declaration; } } $v = explode(".", $version = sqlite_libversion()); $version_number = $v[0] * 1000000 + $v[1] * 1000 + $v[2]; for ($change = 0, Reset($changes); $change < count($changes); Next($changes), $change++) { switch (Key($changes)) { case "name": if ($version_number < 3001000) { return $db->SetError("Alter table", "table renaming is only supported in SQLite 3.1.0 and your version is " . $version); } break; case "AddedFields": if ($version_number < 3001000) { return $db->SetError("Alter table", "table column adding is only supported in SQLite 3.2.0 and your version is " . $version); } break; case "AutoIncrement": case "PrimaryKey": case "SQL": break; case "RenamedFields": case "RemovedFields": case "ChangedFields": case "AddedPrimaryKey": case "RemovedPrimaryKey": case "ChangedPrimaryKey": default: return $db->SetError("Alter table", "change type \"" . Key($changes) . "\" not yet supported"); } } if (isset($changes["SQL"])) { $changes["SQL"] = $sql; } if (!$check) { for ($statement = 0; $statement < count($sql); $statement++) { if (!$db->Query($sql[$statement])) { return 0; } } } return 1; }
/** * Filters data source. * @param mixed * @return void */ public function applyFilter($value) { if (!$this->hasFilter()) { return; } $datagrid = $this->getDataGrid(TRUE); $column = $this->getName(); $cond = array(); if (strstr($value, '*')) { // rewrite asterix to regex usage (*str -> *str$, str* -> ^str*, st*r -> st.*r) $f = $value[0]; $l = $value[strlen($value) - 1]; if ($f == '*' && $l == '*') { $value = "^{$value}\$"; } elseif ($f == '*' && $l != '$') { $value = "{$value}\$"; } elseif ($l == '*' && $f != '^') { $value = "^{$value}"; } $value = str_replace('.*', '*', $value); $value = str_replace('*', '.*', $value); // NOTE: sqlite2 does not have REGEXP statement, you must register your own function $driver = $datagrid->dataSource->getConnection()->getConfig('driver'); if ($driver == 'sqlite' && (int) sqlite_libversion() == 2) { $cond[] = array("REGEXP({$column}, '{$value}')"); } else { $cond[] = array("[{$column}] REGEXP '{$value}'"); } } elseif ($value === 'NULL' || $value === 'NOT NULL') { $cond[] = array("[{$column}] IS {$value}"); } else { $cond[] = array("[{$column}] LIKE '%{$value}%'"); } $datagrid->dataSource->where('%and', $cond); }
function ServerInfo() { $arr['version'] = sqlite_libversion(); //**tochange $arr['description'] = 'SQLite '; //**tochange $arr['encoding'] = sqlite_libencoding(); //**tochange return $arr; }
/** * This function will return the version of the database server software. * * @returns The version of the database server software. */ function getServerVersion() { // Connect $result = $this->connect(); // Handle errors if (!$result && $this->_failOnError === true) { trigger_error($GLOBALS['YD_SQLITE_error'], YD_ERROR); } // Return the version return 'SQLite ' . sqlite_libversion(); }
public function getAttribute($attribute, &$source = null, $func = 'PDO::getAttribute', &$last_error = null) { switch ($attribute) { case PDO::ATTR_AUTOCOMMIT: return $this->autocommit; break; case PDO::ATTR_CLIENT_VERSION: return sqlite_libversion(); break; case PDO::ATTR_SERVER_VERSION: return sqlite_libversion(); break; default: return parent::getAttribute($attribute, $source, $func, $last_error); break; } }
/** +---------------------------------------------------------- * 连接数据库方法 +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @throws ThinkExecption +---------------------------------------------------------- */ public function connect($config = '', $linkNum = 0) { if (!isset($this->linkID[$linkNum])) { if (empty($config)) { $config = $this->config; } $conn = $this->pconnect ? 'sqlite_popen' : 'sqlite_open'; $this->linkID[$linkNum] = $conn($config['database'], $config['mode']); if (!$this->linkID[$linkNum]) { throw_exception(sqlite_error_string()); return false; } $this->dbVersion = sqlite_libversion(); // 标记连接成功 $this->connected = true; //注销数据库安全信息 if (1 != C('DB_DEPLOY_TYPE')) { unset($this->config); } } return $this->linkID[$linkNum]; }
/** * Version number query string * * @access public * @return string */ function _version() { return sqlite_libversion(); }
echo isfun("msql_close"); ?> </td> </tr> <tr> <td>SQLite 数据库:</td> <td><?php if (extension_loaded('sqlite3')) { $sqliteVer = SQLite3::version(); echo '<font color=green>√</font> '; echo "SQLite3 Ver "; echo $sqliteVer[versionString]; } else { echo isfun("sqlite_close"); if (isfun("sqlite_close") == '<font color="green">√</font>') { echo " 版本: " . @sqlite_libversion(); } } ?> </td> <td>Hyperwave 数据库:</td> <td><?php echo isfun("hw_close"); ?> </td> </tr> <tr> <td>Postgre SQL 数据库:</td> <td><?php echo isfun("pg_close"); ?>
/** * 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']; } elseif (function_exists('sqlite_libversion')) { $server_info = @sqlite_libversion(); } if (!$server_info) { return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'Requires either the "server_version" option or the sqlite_libversion() function', __FUNCTION__); } // cache server_info $this->connected_server_info = $server_info; if (!$native) { $tmp = explode('.', $server_info, 3); $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' => null, 'native' => $server_info); } return $server_info; }
$load_averages = @explode(' ', $load_averages); $server_load = isset($load_averages[2]) ? $load_averages[0] . ' ' . $load_averages[1] . ' ' . $load_averages[2] : 'Not available'; } else { if (preg_match('/averages?: ([0-9\\.]+),[\\s]+([0-9\\.]+),[\\s]+([0-9\\.]+)/i', @exec('uptime'), $load_averages)) { $server_load = $load_averages[1] . ' ' . $load_averages[2] . ' ' . $load_averages[3]; } else { $server_load = 'Not available'; } } // Get number of current visitors $result = $db->query('SELECT COUNT(user_id) FROM ' . $db->prefix . 'online WHERE idle=0') or error('Unable to fetch online count', __FILE__, __LINE__, $db->error()); $num_online = $db->result($result); // Get the database system version switch ($db_type) { case 'sqlite': $db_version = 'SQLite ' . sqlite_libversion(); break; default: $result = $db->query('SELECT VERSION()') or error('Unable to fetch version info', __FILE__, __LINE__, $db->error()); $db_version = $db->result($result); break; } // Collect some additional info about MySQL if ($db_type == 'mysql' || $db_type == 'mysqli') { $db_version = 'MySQL ' . $db_version; // Calculate total db size/row count $result = $db->query('SHOW TABLE STATUS FROM `' . $db_name . '`') or error('Unable to fetch table status', __FILE__, __LINE__, $db->error()); $total_records = $total_size = 0; while ($status = $db->fetch_assoc($result)) { $total_records += $status['Rows']; $total_size += $status['Data_length'] + $status['Index_length'];
session_register("noframe"); $_SESSION["noframe"] = $noframe = true; } if (!file_exists("./theme/" . $localtheme . "/define.php")) { unset($_COOKIE["SQLiteManager_currentTheme"]); $localtheme = "default"; } include_once "./theme/" . $localtheme . "/define.php"; if (!CheckExtension('sqlite') && !(CheckExtension('pdo') && CheckExtension('pdo_sqlite'))) { displayError($traduct->get(6)); exit; } else { // Search SQLite versions (if available version2 and version3) $tabSQLiteVersion = array(); if (function_exists('sqlite_open')) { $tabSQLiteVersion[] = sqlite_libversion(); } if (class_exists('PDO') && in_array('sqlite', PDO::getavailabledrivers())) { $dbVersion = new PDO('sqlite::memory:', '', ''); $query = "SELECT sqlite_version();"; $res = $dbVersion->query($query); $tabSQLiteVersion[] = $res->fetchColumn(); unset($dbVersion); } $SQLiteVersion = implode(' - ', $tabSQLiteVersion); $sqliteVersionAvailable = array(); foreach ($tabSQLiteVersion as $versionAvailable) { $sqliteVersionAvailable[] = substr($versionAvailable, 0, 1); } if (!defined('SQLiteDb')) { if (isset($sqliteVersionAvailable)) {
/** * This function will return the version of the database server software. * * @returns The version of the database server software. */ function getServerVersion() { $this->connect(); return 'SQLite ' . sqlite_libversion(); }
/** * 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; }
/** * Drop column */ function sql_column_remove($table_name, $column_name, $inline = false) { $statements = array(); switch ($this->sql_layer) { case 'firebird': $statements[] = 'ALTER TABLE ' . $table_name . ' DROP "' . strtoupper($column_name) . '"'; break; case 'mssql': $statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; break; case 'mysql_40': case 'mysql_41': $statements[] = 'ALTER TABLE `' . $table_name . '` DROP COLUMN `' . $column_name . '`'; break; case 'oracle': $statements[] = 'ALTER TABLE ' . $table_name . ' DROP ' . $column_name; break; case 'postgres': $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN "' . $column_name . '"'; break; case 'sqlite': if ($inline && $this->return_statements) { return $column_name; } if (version_compare(sqlite_libversion(), '3.0') == -1) { $sql = "SELECT sql FROM sqlite_master WHERE type = 'table' AND name = '{$table_name}' ORDER BY type DESC, name;"; $result = $this->db->sql_query($sql); if (!$result) { break; } $row = $this->db->sql_fetchrow($result); $this->db->sql_freeresult($result); $statements[] = 'begin'; // Create a backup table and populate it, destroy the existing one $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; $statements[] = 'DROP TABLE ' . $table_name; preg_match('#\((.*)\)#s', $row['sql'], $matches); $new_table_cols = trim($matches[1]); $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); $column_list = array(); foreach ($old_table_cols as $declaration) { $entities = preg_split('#\s+#', trim($declaration)); if ($entities[0] == 'PRIMARY' || $entities[0] === $column_name) { continue; } $column_list[] = $entities[0]; } $columns = implode(',', $column_list); $new_table_cols = $new_table_cols = preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $new_table_cols); // create a new table and fill it up. destroy the temp one $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; $statements[] = 'DROP TABLE ' . $table_name . '_temp'; $statements[] = 'commit'; } else { $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN ' . $column_name; } break; } return $this->_sql_run_sql($statements); }
/** * return version information about the server * * @param string $native determines if the raw version string should be returned * @return mixed array/string with version information or MDB2 error object * @access private */ function _getServerVersion($native = false) { if (!function_exists('sqlite_libversion')) { return 0; // error } $server_info = sqlite_libversion(); if (!$native) { $tmp = explode('.', $server_info, 3); $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' => null, 'native' => $server_info); } return $server_info; }
function getVersion() { if ($this->conn) { // cache if ($this->version) { return $this->version; } if ($this->adapter == "mysql") { $verSql = mysql_get_server_info(); $version = explode("-", $verSql); $this->version = $version[0]; return $this->version; } else { if ($this->adapter == "sqlite") { $this->version = sqlite_libversion(); return $this->version; } } } }
/** * Returns the libary version string. * * @return string */ public function client_version() { return 'SQLite ' . sqlite_libversion(); }
/** * Constructeur de classe * * @param string $dbname Nom de la base de données * @param array $options Options de connexion/utilisation * * @access public */ function Wadb_sqlite($sqlite_db, $options = null) { if (file_exists($sqlite_db)) { if (!is_readable($sqlite_db)) { trigger_error("SQLite database isn't readable!", E_USER_WARNING); } } else { if (!is_writable(dirname($sqlite_db))) { trigger_error(dirname($sqlite_db) . " isn't writable. Cannot create " . basename($sqlite_db) . " database", E_USER_WARNING); } } $connect = 'sqlite_open'; if (is_array($options)) { $this->options = $options; if (!empty($options['persistent'])) { $connect = 'sqlite_popen'; } } if ($this->link = $connect($sqlite_db, 0666, $this->error)) { sqlite_exec($this->link, 'PRAGMA short_column_names = 1'); sqlite_exec($this->link, 'PRAGMA case_sensitive_like = 0'); ini_set('sqlite.assoc_case', '0'); $this->libVersion = sqlite_libversion(); // if( !empty($this->options['charset']) ) { // $this->encoding($this->options['charset']); // } } }
/** * Return sql statement for adding a new field ident (profile field) to the profile fields data table */ function add_field_ident($field_ident, $field_type) { global $db; switch ($db->sql_layer) { case 'mysql': case 'mysql4': case 'mysqli': // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD `{$field_ident}` "; switch ($field_type) { case FIELD_STRING: $sql .= ' VARCHAR(255) '; break; case FIELD_DATE: $sql .= 'VARCHAR(10) '; break; case FIELD_TEXT: $sql .= "TEXT"; // ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL, // ADD {$field_ident}_bbcode_bitfield INT(11) UNSIGNED"; break; case FIELD_BOOL: $sql .= 'TINYINT(2) '; break; case FIELD_DROPDOWN: $sql .= 'MEDIUMINT(8) '; break; case FIELD_INT: $sql .= 'BIGINT(20) '; break; } break; case 'sqlite': switch ($field_type) { case FIELD_STRING: $type = ' VARCHAR(255) '; break; case FIELD_DATE: $type = 'VARCHAR(10) '; break; case FIELD_TEXT: $type = "TEXT(65535)"; // ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL, // ADD {$field_ident}_bbcode_bitfield INT(11) UNSIGNED"; break; case FIELD_BOOL: $type = 'TINYINT(2) '; break; case FIELD_DROPDOWN: $type = 'MEDIUMINT(8) '; break; case FIELD_INT: $type = 'BIGINT(20) '; break; } // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. if (version_compare(sqlite_libversion(), '3.0') == -1) { $sql = "SELECT sql\n\t\t\t\t\t\tFROM sqlite_master\n\t\t\t\t\t\tWHERE type = 'table'\n\t\t\t\t\t\t\tAND name = '" . PROFILE_FIELDS_DATA_TABLE . "'\n\t\t\t\t\t\tORDER BY type DESC, name;"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); // Create a temp table and populate it, destroy the existing one $db->sql_query(preg_replace('#CREATE\\s+TABLE\\s+"?' . PROFILE_FIELDS_DATA_TABLE . '"?#i', 'CREATE TEMPORARY TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp', $row['sql'])); $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . '_temp SELECT * FROM ' . PROFILE_FIELDS_DATA_TABLE); $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE); preg_match('#\\((.*)\\)#s', $row['sql'], $matches); $new_table_cols = trim($matches[1]); $old_table_cols = explode(',', $new_table_cols); $column_list = array(); foreach ($old_table_cols as $declaration) { $entities = preg_split('#\\s+#', trim($declaration)); if ($entities[0] == 'PRIMARY') { continue; } $column_list[] = $entities[0]; } $columns = implode(',', $column_list); $new_table_cols = $field_ident . ' ' . $type . ',' . $new_table_cols; // create a new table and fill it up. destroy the temp one $db->sql_query('CREATE TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $new_table_cols . ');'); $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . PROFILE_FIELDS_DATA_TABLE . '_temp;'); $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp'); } else { $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD {$field_ident} [{$type}]"; } break; case 'mssql': case 'mssql_odbc': case 'mssqlnative': // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. $sql = 'ALTER TABLE [' . PROFILE_FIELDS_DATA_TABLE . "] ADD [{$field_ident}] "; switch ($field_type) { case FIELD_STRING: $sql .= ' [VARCHAR] (255) '; break; case FIELD_DATE: $sql .= '[VARCHAR] (10) '; break; case FIELD_TEXT: $sql .= "[TEXT]"; // ADD {$field_ident}_bbcode_uid [VARCHAR] (5) NOT NULL, // ADD {$field_ident}_bbcode_bitfield [INT] UNSIGNED"; break; case FIELD_BOOL: case FIELD_DROPDOWN: $sql .= '[INT] '; break; case FIELD_INT: $sql .= '[FLOAT] '; break; } break; case 'postgres': // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD COLUMN \"{$field_ident}\" "; switch ($field_type) { case FIELD_STRING: $sql .= ' VARCHAR(255) '; break; case FIELD_DATE: $sql .= 'VARCHAR(10) '; break; case FIELD_TEXT: $sql .= "TEXT"; // ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL, // ADD {$field_ident}_bbcode_bitfield INT4 UNSIGNED"; break; case FIELD_BOOL: $sql .= 'INT2 '; break; case FIELD_DROPDOWN: $sql .= 'INT4 '; break; case FIELD_INT: $sql .= 'INT8 '; break; } break; case 'firebird': // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' ADD "' . strtoupper($field_ident) . '" '; switch ($field_type) { case FIELD_STRING: $sql .= ' VARCHAR(255) '; break; case FIELD_DATE: $sql .= 'VARCHAR(10) '; break; case FIELD_TEXT: $sql .= "BLOB SUB_TYPE TEXT"; // ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL, // ADD {$field_ident}_bbcode_bitfield INTEGER UNSIGNED"; break; case FIELD_BOOL: case FIELD_DROPDOWN: $sql .= 'INTEGER '; break; case FIELD_INT: $sql .= 'DOUBLE PRECISION '; break; } break; case 'oracle': // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD {$field_ident} "; switch ($field_type) { case FIELD_STRING: $sql .= ' VARCHAR2(255) '; break; case FIELD_DATE: $sql .= 'VARCHAR2(10) '; break; case FIELD_TEXT: $sql .= "CLOB"; // ADD {$field_ident}_bbcode_uid VARCHAR2(5) NOT NULL, // ADD {$field_ident}_bbcode_bitfield NUMBER(11) UNSIGNED"; break; case FIELD_BOOL: $sql .= 'NUMBER(2) '; break; case FIELD_DROPDOWN: $sql .= 'NUMBER(8) '; break; case FIELD_INT: $sql .= 'NUMBER(20) '; break; } break; } return $sql; }
function Test($ini = false) { if ($ini) { return ini_get_all(); } $result = array(); $result['now'] = date('Y-m-d H:i:s', time()); $result['stream_get_meta_data'] = function_exists('stream_get_meta_data') ? 'True' : 'False'; $result['ShockwaveFlash'] = function_exists('swf_openfile') ? 'True' : 'False'; $result['SoapClient'] = class_exists('SoapClient') ? 'True' : 'False'; $result['http_support'] = function_exists('http_support') ? 'True' : 'False'; $result['HttpRequest'] = class_exists('HttpRequest') ? 'True' : 'False'; $result['HttpResponse'] = class_exists('HttpResponse') ? 'True' : 'False'; $result['DOMDocument'] = class_exists('DOMDocument') ? 'True' : 'False'; if (function_exists('sqlite_libversion')) { $result['sqlite'] = sqlite_libversion(); } else { $result['sqlite'] = 'False'; } if (class_exists('PDO')) { $result['pdo'] = PDO::getAvailableDrivers(); } else { $result['pdo'] = 'False'; } if (function_exists('gd_info')) { $result['gd'] = gd_info(); } else { $result['gd'] = 'False'; } $result['rootDir'] = $this->__RootFolder; $result['virtualDir'] = $this->__VirtualFolders; return $result; }
function get_version() { return array('name' => 'SQLite', 'version' => sqlite_libversion()); }
function sql_server_info($link = null) { $result = sqlite_libversion(); return $result; }
/** * Gets the current SQLite library version * * @return string */ function get_server_info() { return sqlite_libversion(); }
public function getAttribute($attribute) { switch ($attribute) { case DoLite::ATTR_SERVER_INFO: return sqlite_libencoding(); break; case DoLite::ATTR_SERVER_VERSION: case DoLite::ATTR_CLIENT_VERSION: return sqlite_libversion(); break; case DoLite::ATTR_PERSISTENT: return $this->_persistent; break; } return null; }
<td align="left"><?php echo function_exists('oci_connect') ? '<b class="ok">' . $okImg . '</b><span class="item"> (' . ociserverversion() . ')</span>' : '<span class="warning">' . $failedImg . ' Not available</span>'; ?> </td> </tr> <tr> <td class="item"><li>PostgreSQL Support</li></td> <td align="left"><?php echo function_exists('pg_connect') ? '<b class="ok">' . $okImg . '</b><span class="item"></span>' : '<span class="warning">' . $failedImg . ' Not available</span>'; ?> </td> </tr> <tr> <td class="item"><li>SQLite Support</li></td> <td align="left"><?php echo function_exists('sqlite_open') ? '<b class="ok">' . $okImg . '</b><span class="item"> (' . sqlite_libversion() . ')</span>' : '<span class="warning">' . $failedImg . ' Not available</span>'; ?> </td> </tr> <tr> <td class="item"><li>Sybase Support</li></td> <td align="left"><?php echo function_exists('sybase_connect') ? '<b class="ok">' . $okImg . '</b><span class="item"> </span>' : '<span class="warning">' . $failedImg . ' Not available</span>'; ?> </td> </tr> <tr> <td class="title" colspan="2"><br />Check for Directory and File Permissions</td> </tr> <tr> <td class="item" colspan="2">If the message 'World Writable' appears after a file/directory, then Permissions for this File have been set to allow all users to write to this file/directory.
function smf_db_libversion($void = null) { return sqlite_libversion(); }
/** * Database version number * * @return string */ public function version() { return isset($this->data_cache['version']) ? $this->data_cache['version'] : ($this->data_cache['version'] = sqlite_libversion()); }
function version() { return intval(str_replace('.', '', sqlite_libversion())); }