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


PHP DBUtil类代码示例

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


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

示例1: checkForDuplicateReg

 public function checkForDuplicateReg($params)
 {
     $db = new DBUtil();
     $sql = "select count(*) as count from person p \n" . "join user u on p.person_id = u.person_id \n" . "join contact c on p.person_id = c.person_id \n" . "where email = :email or login = :username \n" . "or (first_name = :first_name and last_name = :last_name and postal_code = :postal_code) \n";
     $stmt = $db->query($sql, $params);
     if ($stmt && ($row = $stmt->fetch(PDO::FETCH_OBJ))) {
         echo print_r($row, true);
         if (empty($row->count)) {
             // we haven't created this example or a similar user doesn't already exist
             return false;
         }
     }
     return true;
 }
开发者ID:recoveredvader,项目名称:NilFactorFrameWork,代码行数:14,代码来源:NilFactorReg.php

示例2: _createOperationLog

 /**
  * Creates a new logging instance.
  *
  * @param Doctrine_Event $event  Event.
  * @param int            $opType I/U/D for Insert/Update/Delete.
  *
  * @return void
  */
 private function _createOperationLog(Doctrine_Event $event, $opType = 'I')
 {
     $data = $event->getInvoker();
     $tableName = $this->getTableNameFromEvent($event);
     $idColumn = $this->getIdColumnFromEvent($event);
     $log = array();
     $log['object_type'] = $tableName;
     $log['object_id'] = $data[$idColumn];
     $log['op'] = $opType;
     if ($opType == 'U') {
         $oldValues = $data->getLastModified(true);
         $diff = array();
         foreach ($oldValues as $column => $oldValue) {
             if (empty($oldValue) && isset($data[$column]) && !empty($data[$column])) {
                 $diff[$column] = 'I: ' . $data[$column];
             } elseif (!empty($oldValue) && isset($data[$column]) && !empty($data[$column])) {
                 $diff[$column] = 'U: ' . $data[$column];
             } elseif (!empty($oldValue) && empty($data[$column])) {
                 $diff[$column] = 'D: ' . $oldValue;
             }
         }
         $log['diff'] = serialize($diff);
     } else {
         // Convert object to array (otherwise we serialize the record object)
         $log['diff'] = serialize($data->toArray());
     }
     DBUtil::insertObject($log, 'objectdata_log');
 }
开发者ID:Silwereth,项目名称:core,代码行数:36,代码来源:Logging.php

示例3: Authenticate

 public static function Authenticate($username, $pass)
 {
     $o = new DBUtil();
     $username = mysql_real_escape_string($username);
     $pass = md5(mysql_real_escape_string($pass));
     $query = "CALL " . SP_LOGIN . "('" . $username . "','" . $pass . "')";
     $res = $o->fetch($query);
     $row = mysql_fetch_array($res);
     $loginInfo = new LoginInfo();
     $loginInfo->msg = $row['res_msg'];
     $loginInfo->id = $row['id1'];
     return $loginInfo;
 }
开发者ID:nandkunal,项目名称:sustain-brand,代码行数:13,代码来源:loginManager.php

示例4: display

 function display()
 {
     $prevpage = null;
     $nextpage = null;
     $page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId));
     $tables = DBUtil::getTables();
     $pageTable = $tables['content_page'];
     $pageColumn = $tables['content_page_column'];
     $options = array('makeTree' => true);
     $options['orderBy'] = 'position';
     $options['orderDir'] = 'desc';
     $options['pageSize'] = 1;
     $options['filter']['superParentId'] = $page['parentPageId'];
     if ($page['position'] > 0) {
         $options['filter']['where'] = "{$pageColumn['level']} = {$page['level']} and {$pageColumn['position']} < {$page['position']}";
         $pages = ModUtil::apiFunc('Content', 'Page', 'getPages', $options);
         if (count($pages) > 0) {
             $prevpage = $pages[0];
         }
     }
     if (isset($page['position']) && $page['position'] >= 0) {
         $options['orderDir'] = 'asc';
         $options['filter']['where'] = "{$pageColumn['level']} = {$page['level']} and {$pageColumn['position']} > {$page['position']}";
         $pages = ModUtil::apiFunc('Content', 'Page', 'getPages', $options);
         if (count($pages) > 0) {
             $nextpage = $pages[0];
         }
     }
     $this->view->assign('loggedin', UserUtil::isLoggedIn());
     $this->view->assign('prevpage', $prevpage);
     $this->view->assign('nextpage', $nextpage);
     return $this->view->fetch($this->getTemplate());
 }
开发者ID:robbrandt,项目名称:Content,代码行数:33,代码来源:PageNavigation.php

示例5: do_main

 function do_main()
 {
     $this->oPage->setBreadcrumbDetails(_kt("transactions"));
     $this->oPage->setTitle(_kt('Folder transactions'));
     $folder_data = array();
     $folder_data["folder_id"] = $this->oFolder->getId();
     $this->oPage->setSecondaryTitle($this->oFolder->getName());
     $aTransactions = array();
     // FIXME do we really need to use a raw db-access here?  probably...
     $sQuery = "SELECT DTT.name AS transaction_name, FT.transaction_namespace, U.name AS user_name, FT.comment AS comment, FT.datetime AS datetime " . "FROM " . KTUtil::getTableName("folder_transactions") . " AS FT LEFT JOIN " . KTUtil::getTableName("users") . " AS U ON FT.user_id = U.id " . "LEFT JOIN " . KTUtil::getTableName("transaction_types") . " AS DTT ON DTT.namespace = FT.transaction_namespace " . "WHERE FT.folder_id = ? ORDER BY FT.datetime DESC";
     $aParams = array($this->oFolder->getId());
     $res = DBUtil::getResultArray(array($sQuery, $aParams));
     if (PEAR::isError($res)) {
         var_dump($res);
         // FIXME be graceful on failure.
         exit(0);
     }
     // FIXME roll up view transactions
     $aTransactions = $res;
     // Set the namespaces where not in the transactions lookup
     foreach ($aTransactions as $key => $transaction) {
         if (empty($transaction['transaction_name'])) {
             $aTransactions[$key]['transaction_name'] = $this->_getActionNameForNamespace($transaction['transaction_namespace']);
         }
     }
     // render pass.
     $this->oPage->title = _kt("Folder History");
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("kt3/view_folder_history");
     $aTemplateData = array("context" => $this, "folder_id" => $folder_id, "folder" => $this->oFolder, "transactions" => $aTransactions);
     return $oTemplate->render($aTemplateData);
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:32,代码来源:Transactions.php

示例6: transform

 function transform()
 {
     global $default;
     $iMimeTypeId = $this->oDocument->getMimeTypeId();
     $sMimeType = KTMime::getMimeTypeName($iMimeTypeId);
     $sFileName = $this->oDocument->getFileName();
     $aTestTypes = array('application/octet-stream', 'application/zip', 'application/x-zip');
     if (in_array($sMimeType, $aTestTypes)) {
         $sExtension = KTMime::stripAllButExtension($sFileName);
         $sTable = KTUtil::getTableName('mimetypes');
         $sQuery = "SELECT id, mimetypes FROM {$sTable} WHERE LOWER(filetypes) = ?";
         $aParams = array($sExtension);
         $aRow = DBUtil::getOneResult(array($sQuery, $aParams));
         if (PEAR::isError($aRow)) {
             $default->log->debug("ODI: error in query: " . print_r($aRow, true));
             return;
         }
         if (empty($aRow)) {
             $default->log->debug("ODI: query returned entry");
             return;
         }
         $id = $aRow['id'];
         $mimetype = $aRow['mimetypes'];
         $default->log->debug("ODI: query returned: " . print_r($aRow, true));
         if (in_array($mimetype, $aTestTypes)) {
             // Haven't changed, really not an OpenDocument file...
             return;
         }
         if ($id) {
             $this->oDocument->setMimeTypeId($id);
             $this->oDocument->update();
         }
     }
     parent::transform();
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:35,代码来源:OpenDocumentIndexer.php

示例7: upgrade

 /**
  * upgrade the module from an old version
  *
  * This function must consider all the released versions of the module!
  * If the upgrade fails at some point, it returns the last upgraded version.
  *
  * @param        string   $oldVersion   version number string to upgrade from
  * @return       mixed    true on success, last valid version string or false if fails
  */
 public function upgrade($oldversion)
 {
     // Upgrade dependent on old version number
     switch ($oldversion) {
         case '3.6':
             // Rename 'thelang' block.
             $table = 'blocks';
             $sql = "UPDATE {$table} SET bkey = 'lang' WHERE bkey = 'thelang'";
             \DBUtil::executeSQL($sql);
             // Optional upgrade
             if (in_array(\DBUtil::getLimitedTablename('message'), \DBUtil::metaTables())) {
                 $this->migrateMessages();
             }
             $this->migrateBlockNames();
             $this->migrateExtMenu();
         case '3.7':
         case '3.7.0':
             if (!\DBUtil::changeTable('blocks')) {
                 return false;
             }
         case '3.7.1':
             $this->newBlockPositions();
         case '3.8.0':
             // update empty filter fields to an empty array
             $entity = $this->name . '\\Entity\\Block';
             $dql = "UPDATE {$entity} p SET p.filter = 'a:0:{}' WHERE p.filter = '' OR p.filter = 's:0:\"\";'";
             $query = $this->entityManager->createQuery($dql);
             $query->getResult();
         case '3.8.1':
             // future upgrade routines
     }
     // Update successful
     return true;
 }
开发者ID:planetenkiller,项目名称:core,代码行数:43,代码来源:Installer.php

示例8: IWmenu_tables

/**
 * Define module tables
 * @author Albert Perez Monfort (aperezm@xtec.cat)
 * @return module tables information
 */
function IWmenu_tables() {
    // Initialise table array
    $tables = array();

    // IWmain table definition
    $tables['IWmenu'] = DBUtil::getLimitedTablename('IWmenu');

    //Noms dels camps
    $tables['IWmenu_column'] = array('mid' => 'iw_mid',
        'text' => 'iw_text',
        'url' => 'iw_url',
        'id_parent' => 'iw_id_parent',
        'groups' => 'iw_groups',
        'active' => 'iw_active',
        'target' => 'iw_target',
        'descriu' => 'iw_descriu',
        'iorder' => 'iw_iorder',
        'icon' => 'iw_icon',);

    $tables['IWmenu_column_def'] = array('mid' => "I NOTNULL AUTO PRIMARY",
        'text' => "C(255) NOTNULL DEFAULT ''",
        'url' => "X NOTNULL",
        'id_parent' => "I NOTNULL DEFAULT '0'",
        'groups' => "X NOTNULL",
        'active' => "I(1) NOTNULL DEFAULT '0'",
        'target' => "I(1) NOTNULL DEFAULT '0'",
        'descriu' => "X NOTNULL",
        'iorder' => "I NOTNULL DEFAULT '0'",
        'icon' => "C(40) NOTNULL DEFAULT ''");

    // Return the table information
    return $tables;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:38,代码来源:tables.php

示例9: upgrade

    /**
     * Update the IWwebbox module
     * @author Albert Pérez Monfort (aperezm@xtec.cat)
     * @author Jaume Fernàndez Valiente (jfern343@xtec.cat)
     * @return bool true if successful, false otherwise
     */
    public function upgrade($oldversion) {

        // Update z_blocs table

        $c = "UPDATE blocks SET bkey = 'Webbox' WHERE bkey = 'webbox'";
        if (!DBUtil::executeSQL($c)) {
            return false;
        }

        //Array de noms
        $oldVarsNames = DBUtil::selectFieldArray("module_vars", 'name', "`modname` = 'IWwebbox'", '', false, '');

        $newVarsNames = Array('url', 'width', 'height', 'scrolls', 'widthunit');

        $newVars = Array('url' => 'http://phobos.xtec.cat/intraweb',
            'width' => '100',
            'height' => '600',
            'scrolls' => '1',
            'widthunit' => '%');    

        // Delete unneeded vars
        $del = array_diff($oldVarsNames, $newVarsNames);
        foreach ($del as $i) {
            $this->delVar($i);
        }

        // Add new vars
        $add = array_diff($newVarsNames, $oldVarsNames);
        foreach ($add as $i) {
            $this->setVar($i, $newVars[$i]);
        }

        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:40,代码来源:Installer.php

示例10: down

 public function down()
 {
     $tables = array('bans', 'user_metadata', 'user_security', 'user_groups', 'users', 'group_permissions', 'groups_users');
     foreach ($tables as $table) {
         \DBUtil::drop_table($table);
     }
 }
开发者ID:inespons,项目名称:ethanol,代码行数:7,代码来源:001_create_ethanol_tables.php

示例11: getModuleConfig

 public function getModuleConfig($args)
 {
     if (!isset($args['modulename'])) {
         $args['modulename'] = ModUtil::getName();
     }
     $modconfig = array();
     if ($args['modulename'] == 'list') {
         $modconfig = DBUtil::selectObjectArray('scribite', '', 'modname');
     } else {
         $dbtables = DBUtil::getTables();
         $scribitecolumn = $dbtables['scribite_column'];
         $where = "{$scribitecolumn['modname']} = '" . $args['modulename'] . "'";
         $item = DBUtil::selectObjectArray('scribite', $where);
         if ($item == false) {
             return;
         }
         $modconfig['mid'] = $item[0]['mid'];
         $modconfig['modulename'] = $item[0]['modname'];
         if (!is_int($item[0]['modfuncs'])) {
             $modconfig['modfuncs'] = unserialize($item[0]['modfuncs']);
         }
         if (!is_int($item[0]['modareas'])) {
             $modconfig['modareas'] = unserialize($item[0]['modareas']);
         }
         $modconfig['modeditor'] = $item[0]['modeditor'];
     }
     return $modconfig;
 }
开发者ID:rmaiwald,项目名称:Scribite,代码行数:28,代码来源:User.php

示例12: down

 function down()
 {
     // get the driver used
     \Config::load('auth', true);
     $drivers = \Config::get('auth.driver', array());
     is_array($drivers) or $drivers = array($drivers);
     if (in_array('Simpleauth', $drivers)) {
         // get the tablename
         \Config::load('simpleauth', true);
         $table = \Config::get('simpleauth.table_name', 'users') . '_providers';
         // make sure the configured DB is used
         \DBUtil::set_connection(\Config::get('simpleauth.db_connection', null));
     } elseif (in_array('Ormauth', $drivers)) {
         // get the tablename
         \Config::load('ormauth', true);
         $table = \Config::get('ormauth.table_name', 'users') . '_providers';
         // make sure the configured DB is used
         \DBUtil::set_connection(\Config::get('ormauth.db_connection', null));
     }
     if (isset($table)) {
         // drop the users remote table
         \DBUtil::drop_table($table);
     }
     // reset any DBUtil connection set
     \DBUtil::set_connection(null);
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:26,代码来源:008_auth_create_providers.php

示例13: getref

    /**
     * Return a reference depending on this reference name
     *
     * @param    int     $args['ref']    Id of the reference that have to be returned
     * @return   array   array of items, or false on failure
     */
    public function getref($args) {
        if (!isset($args['ref'])) {
            return LogUtil::registerError(__('Error! Could not do what you wanted. Please check your input.'));
        }

        return DBUtil::selectObjectByID('IWwebbox', $args['ref'], 'ref', '', '');
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:13,代码来源:User.php

示例14: ruleDeleted

 public function ruleDeleted($rid)
 {
     $form = DBUtil::findUnique(DBUtil::$TABLE_ORDER_FORM, array(":rid" => $rid));
     pdo_delete(DBUtil::$TABLE_ORDER_ITEM, array("fid" => $form['id']));
     pdo_delete(DBUtil::$TABLE_ORDER_ORDER, array("fid" => $form['id']));
     pdo_delete(DBUtil::$TABLE_ORDER_FORM, array('id' => $form['id']));
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:7,代码来源:module.php

示例15: down

 public function down()
 {
     $tables = array('bans', 'groups_users', 'group_permissions', 'log_in_attempt', 'users', 'user_groups', 'user_metadata', 'user_oauth', 'user_security');
     foreach ($tables as $table) {
         \DBUtil::rename_table('ethanol_' . $table, $table);
     }
 }
开发者ID:inespons,项目名称:ethanol,代码行数:7,代码来源:003_table_prefix.php


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