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


PHP BizSystem::dbConnection方法代码示例

本文整理汇总了PHP中BizSystem::dbConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP BizSystem::dbConnection方法的具体用法?PHP BizSystem::dbConnection怎么用?PHP BizSystem::dbConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BizSystem的用法示例。


在下文中一共展示了BizSystem::dbConnection方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: giveActionAccess

function giveActionAccess($where, $role_id)
{
    $db = BizSystem::dbConnection();
    try {
        if (empty($where)) {
            $sql = "SELECT * FROM acl_action";
        } else {
            $sql = "SELECT * FROM acl_action WHERE {$where}";
        }
        BizSystem::log(LOG_DEBUG, "DATAOBJ", $sql);
        $rs = $db->fetchAll($sql);
        $sql = "";
        foreach ($rs as $r) {
            $sql = "DELETE FROM acl_role_action WHERE role_id={$role_id} AND action_id={$r['0']}; ";
            BizSystem::log(LOG_DEBUG, "DATAOBJ", $sql);
            $db->query($sql);
            $sql = "INSERT INTO acl_role_action (role_id, action_id, access_level) VALUES ({$role_id},{$r['0']},1)";
            BizSystem::log(LOG_DEBUG, "DATAOBJ", $sql);
            $db->query($sql);
        }
    } catch (Exception $e) {
        echo "ERROR: " . $e->getMessage() . "" . PHP_EOL;
        return false;
    }
}
开发者ID:Why-Not-Sky,项目名称:cubi-ng,代码行数:25,代码来源:upgrade_module.php

示例2: open

 function open($savePath, $sessionName)
 {
     // echo "session open".nl;
     // connect to session db
     $this->sessionDb = BizSystem::dbConnection(SESSION_DBNAME);
     $sessionID = session_id();
     if ($sessionID !== "") {
         $this->initSessionData = $this->read($sessionID);
     }
     return true;
 }
开发者ID:Why-Not-Sky,项目名称:cubi-ng,代码行数:11,代码来源:SessionDBHandler.php

示例3: getDBConnection

 /**
  * Get database connection
  *
  * @return Zend_Db_Adapter_Abstract
  **/
 public function getDBConnection()
 {
     return BizSystem::dbConnection($this->m_Database);
 }
开发者ID:pheonix-inno,项目名称:siremis,代码行数:9,代码来源:BizDataObj_Abstract.php

示例4: executeSQL

 /**
  * Execute SQL
  *
  * @param array $argList
  * @return void
  */
 protected function executeSQL($argList)
 {
     $dbName = $argList["DBName"];
     if (!$dbName) {
         $dbName = "Default";
     }
     $sql = $argList["SQL"];
     $db = BizSystem::dbConnection($dbName);
     try {
         $resultSet = $db->query($sql);
     } catch (Exception $e) {
         $errorMessage = "Error in run SQL: " . $sql . ". " . $e->getMessage();
     }
 }
开发者ID:que273,项目名称:siremis,代码行数:20,代码来源:doTriggerService.php

示例5: DBConnection

 public function DBConnection()
 {
     return BizSystem::dbConnection($this->dbName);
 }
开发者ID:que273,项目名称:siremis,代码行数:4,代码来源:ModuleLoader.php

示例6: getDBConnection

 /**
  * Get database connection
  *
  * @return Zend_Db_Adapter_Abstract
  **/
 public function getDBConnection($type = 'default')
 {
     switch (strtolower($type)) {
         case "default":
         case "read":
             if ($this->m_DatabaseforRead) {
                 $dbName = $this->m_DatabaseforRead;
             } else {
                 $dbName = $this->m_Database;
             }
             break;
         case "write":
             if ($this->m_DatabaseforWrite) {
                 $dbName = $this->m_DatabaseforWrite;
             } else {
                 $dbName = $this->m_Database;
             }
             break;
     }
     return BizSystem::dbConnection($dbName);
 }
开发者ID:Why-Not-Sky,项目名称:cubi-ng,代码行数:26,代码来源:BizDataObj_Abstract.php

示例7: trim

echo "This script is to create cubi installation database." . PHP_EOL;
echo "Please create a CubiInstall database in cubi/Config.xml." . PHP_EOL;
echo "Is CubiInstall created? (y/n) ";
// Read the input
$answer = trim(fgets(STDIN));
echo "Your answer is {$answer}" . PHP_EOL;
if ($answer != 'y') {
    exit;
}
include_once dirname(dirname(__FILE__)) . "/app_init.php";
if (!defined("CLI")) {
    exit;
}
include_once MODULE_PATH . "/system/lib/ModuleLoader.php";
$cubiInstallDb = "CubiInstall";
$db = BizSystem::dbConnection($cubiInstallDb);
if (!$db) {
    echo "Please create a CubiInstall database in cubi/Config.xml." . PHP_EOL;
}
$modules = array('system', 'menu');
foreach (glob(MODULE_PATH . DIRECTORY_SEPARATOR . "*") as $dir) {
    $modName = str_replace(MODULE_PATH . DIRECTORY_SEPARATOR, "", $dir);
    if ($modName != "system" && $modName != "menu") {
        array_push($modules, $modName);
    }
}
// find all modules
foreach ($modules as $mod) {
    echo PHP_EOL . "---------------------------------------------------" . PHP_EOL;
    echo "> Start loading '{$mod}' module ..." . PHP_EOL;
    $loader = new ModuleLoader($mod, $cubiInstallDb);
开发者ID:Why-Not-Sky,项目名称:cubi-ng,代码行数:31,代码来源:create_cubidb.php

示例8: getTableIndex

 /**
  * Load table index and uniqueness information
  * @return void
  */
 protected function getTableIndex()
 {
     $db = BizSystem::dbConnection($this->db_name);
     $db_driver = $this->db_config['Driver'];
     switch (strtoupper($db_driver)) {
         case 'PDO_MYSQL':
             $sql = "SHOW INDEX FROM {$this->table_name};";
             $result = $db->query($sql);
             $tblIndexes = $result->fetchAll();
             break;
         default:
             break;
     }
     $tableIndex = array();
     if ($tblIndexes) {
         foreach ($tblIndexes as $colIndex) {
             $non_unique = $colIndex[1];
             $key_name = $colIndex[2];
             $col_name = $colIndex[4];
             if ($key_name != "PRIMARY" && $tblCols[$col_name]['DATA_TYPE'] != 'int') {
                 //$tableIndex[$key_name]=array();
                 $indexInfo = array("NON_UNIQUE" => $non_unique, "KEY_NAME" => $key_name, "COL_NAME" => $col_name);
                 if (!is_array($tableIndex[$key_name])) {
                     $tableIndex[$key_name] = array();
                 }
                 array_push($tableIndex[$key_name], $indexInfo);
             }
         }
     }
     $this->tableIndex = $tableIndex;
     $uniqueness = "";
     foreach ($tableIndex as $key_name => $key_index) {
         $key_uniqueness = "";
         foreach ($key_index as $indexInfo) {
             if ($indexInfo['NON_UNIQUE'] == "0") {
                 if ($key_uniqueness != "") {
                     $key_uniqueness .= ",";
                 }
                 $key_uniqueness .= $indexInfo['COL_NAME'];
             }
         }
         if ($key_uniqueness != "") {
             $uniqueness .= $key_uniqueness . ";";
         }
     }
     $this->uniqueness = $uniqueness;
 }
开发者ID:que273,项目名称:siremis,代码行数:51,代码来源:gen_meta.inc.php

示例9: getDBProfile

 /**
  * Get Database profile
  *
  * @todo not finish
  * @param <type> $userId
  * @param <type> $password
  */
 protected function getDBProfile($userId, $password)
 {
     // CASE 1: simple one table query
     // SELECT role, group, pstn, divn, org FROm user_table AS t1
     // WHERE t1.userid='$userid'
     // CASE 2: intersection table user_pstn (user_role, user_divn, user_org ...), need to query multiple times
     // SELECT t1.pstnid, t2.name FROM user_pstn_table AS t1
     // JOIN pstn_table AS t2 ON t1.pstnid=t2.id
     // WHERE t1.userid='$userid'
     // CASE 3: all hierarchy info contained in one big party table, do query once, then filter on type column
     // SELECT t1.partyid, t2.name, t2.type FROM user_party_table AS t1
     // JOIN party_table AS t2 ON t1.partyid=t2.id
     // WHERE t1.userid='$userid'
     $db = BizSystem::dbConnection();
     $resultSet = $db->execute($sql);
     $sqlArr = $resultSet->fetchRow();
     // process the result
 }
开发者ID:Why-Not-Sky,项目名称:cubi-ng,代码行数:25,代码来源:profileService.php


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