本文整理匯總了PHP中Sqlite::__database方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sqlite::__database方法的具體用法?PHP Sqlite::__database怎麽用?PHP Sqlite::__database使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sqlite
的用法示例。
在下文中一共展示了Sqlite::__database方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: reconnect
function reconnect()
{
global $gbl, $sgbl, $login, $ghtml;
$this->__readserver = 'localhost';
$user = $sgbl->__var_admin_user;
$db = $sgbl->__var_dbf;
$pass = getAdminDbPass();
$readserver = $this->__readserver;
$fdbvar = "__fdb_" . $this->__readserver;
log_log("database_reconnect", "Reconnecting again");
if ($sgbl->__var_database_type === 'mysql') {
$gbl->{$fdbvar} = mysql_connect($readserver, $user, $pass);
mysql_select_db($db);
self::$__database = 'mysql';
} else {
if ($sgbl->__var_database_type === 'mssql') {
//print("$user, $pass <br> \n");
//$gbl->$fdbvar = mssql_connect('\\.\pipe\MSSQL$LXLABS\sql\query');
$gbl->{$fdbvar} = mssql_pconnect("{$readserver},{$sgbl->__var_mssqlport}");
mssql_select_db($db);
self::$__database = 'mssql';
} else {
$gbl->{$fdbvar} = new PDO("sqlite:{$db}");
self::$__database = 'sqlite';
}
}
}
示例2: connect
function connect()
{
global $gbl, $sgbl;
$fdbvar = "__fdb_{$this->__readserver}";
if (!isset($gbl->{$fdbvar}) || $this->__force) {
if (is_running_secondary()) {
throw new lxexception("this_is_a_running_secondary_master", '', "");
}
}
$user = $sgbl->__var_admin_user;
$db = $sgbl->__var_dbf;
$pass = getAdminDbPass();
if ($sgbl->__var_database_type === 'mysql') {
$gbl->{$fdbvar} = mysql_connect($this->__readserver, $user, $pass) or dprint("Could not connect to the MySql server.\n");
mysql_select_db($db) or dprint("Could not select {$db} MySQL database.\n");
self::$__database = 'mysql';
} else {
if ($sgbl->__var_database_type === 'mssql') {
//print("$user, $pass <br> \n");
//$gbl->$fdbvar = mssql_connect('\\.\pipe\MSSQL$LXLABS\sql\query');
$gbl->{$fdbvar} = mssql_pconnect("{$this->__readserver},{$sgbl->__var_mssqlport}") or dprint("Could not connect to the MSSQL server.\n");
mssql_select_db($db) or dprint("Could not select {$db} MSSQL database.\n");
self::$__database = 'mssql';
} else {
try {
$gbl->{$fdbvar} = new PDO("sqlite:{$db}");
self::$__database = 'sqlite';
} catch (PDOException $e) {
dprint("PDO Error: " . $e->getMessage() . "\n");
}
}
}
if (!$gbl->{$fdbvar}) {
die("Could not open database connection.");
}
}