本文整理汇总了PHP中PearDatabase::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP PearDatabase::connect方法的具体用法?PHP PearDatabase::connect怎么用?PHP PearDatabase::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PearDatabase
的用法示例。
在下文中一共展示了PearDatabase::connect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PearDatabase
$old_tables = @mysql_num_rows(mysql_list_tables($old_dbname, $oldconn));
if (!$old_tables) {
echo '<br><font color="red"><b> Tables do not exist in the Source Database</b></font>';
$continue3 = 0;
} else {
$migration_log .= '<br> Tables exist in the Database';
$migrationlog->debug("Tables exist. continue3 = 1");
$continue3 = 1;
}
}
//$continue1 -- Database server can be connected
//$continue2 -- Database exists in the server
//$continue3 -- Tables are exist in the database
if ($continue1 == 1 && $continue2 == 1 && $continue3 == 1) {
$conn = new PearDatabase("mysql", $old_host_name . ":" . $old_mysql_port, $old_dbname, $old_mysql_username, $old_mysql_password);
$conn->connect();
$migrationlog->debug("MICKIE ==> Option = Alter DB details. From the given DB details we will migrate.");
@session_unregister('migration_log');
$_SESSION['migration_log'] = $migration_log;
if ($conn) {
$migrationlog->debug("Database object created. Going to create Migration object");
$obj = new Migration('', $conn);
$obj->setOldDatabaseParams($old_host_name, $old_mysql_port, $old_mysql_username, $old_mysql_password, $old_dbname);
//$obj->migrate($same_databases,'dbsource');
$obj->modifyDatabase($conn);
} else {
echo '<br><font color="red"><b> Cannot make a connection with the current database setup</b></font>';
include "modules/Migration/MigrationStep1.php";
}
} else {
echo '<br><font color="red"><b>ERROR!!!!!!Please check the input values, unable to proceed.</b></font>';
示例2: getLastInsertID
function getLastInsertID($seqname = '')
{
if ($this->isPostgres()) {
$result = pg_query("SELECT currval('" . $seqname . "_seq')");
if ($result) {
$row = pg_fetch_row($result);
$last_insert_id = $row[0];
}
} else {
$last_insert_id = $this->database->Insert_ID();
}
return $last_insert_id;
}
// Function to escape the special characters in database name based on database type.
function escapeDbName($dbName = '')
{
if ($dbName == '') {
$dbName = $this->dbName;
}
if ($this->isMySql()) {
$dbName = "`{$dbName}`";
}
return $dbName;
}
}
/* End of class */
if (empty($adb)) {
$adb = new PearDatabase();
$adb->connect();
}
//$adb->database->setFetchMode(ADODB_FETCH_NUM);
示例3: PearDatabase
function &getSingleDBInstance()
{
static $db = false;
if ($db === false) {
global $log;
$log->info("start create peardatabase");
$db = new PearDatabase();
//$adb->enableSQLlog = true; //log sql
$db->connect();
if ($db->isMssql()) {
$db->database->SetFetchMode(ADODB_FETCH_ASSOC);
}
$log->info("end create peardatabase");
}
return $db;
}