当前位置: 首页>>代码示例>>PHP>>正文


PHP PearDatabase::connect方法代码示例

本文整理汇总了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>';
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:31,代码来源:MigrationCheck.php

示例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);
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:PearDatabase.php

示例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;
}
开发者ID:honj51,项目名称:taobaocrm,代码行数:16,代码来源:PearDatabase.php


注:本文中的PearDatabase::connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。