本文整理汇总了PHP中sqlite_libversion函数的典型用法代码示例。如果您正苦于以下问题:PHP sqlite_libversion函数的具体用法?PHP sqlite_libversion怎么用?PHP sqlite_libversion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sqlite_libversion函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: navi
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");
}
}
示例2: ServerInfo
function ServerInfo()
{
$arr['version'] = sqlite_libversion();
$arr['description'] = 'SQLite ';
$arr['encoding'] = sqlite_libencoding();
return $arr;
}
示例3: AlterTable
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;
}
示例4: applyFilter
/**
* 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);
}
示例5: getServerVersion
/**
* 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();
}
示例6: getAttribute
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;
}
}
示例7: connect
/**
+----------------------------------------------------------
* 连接数据库方法
+----------------------------------------------------------
* @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];
}
示例8: _version
/**
* Version number query string
*
* @access public
* @return string
*/
function _version()
{
return sqlite_libversion();
}
示例9: isfun
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");
?>
示例10: getServerVersion
/**
* 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;
}
示例11: isset
$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'];
示例12: session_register
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)) {
示例13: getServerVersion
/**
* 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();
}
示例14: connect_check_db
/**
* 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'];
}
//.........这里部分代码省略.........
示例15: sql_column_remove
/**
* 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);
}