本文整理汇总了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.");
}
}