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


PHP dmDb::pdo方法代码示例

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


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

示例1: executeCurrentVersion

 public function executeCurrentVersion(dmWebRequest $request)
 {
     if ($branch = $request->getParameter('branch')) {
         $version = dmDb::pdo('SELECT v.number FROM version v INNER JOIN branch b ON v.branch_id = b.id AND b.number = ? WHERE v.is_active = ? ORDER BY v.position ASC LIMIT 1', array(str_replace(array('_', '-'), '.', $branch), true))->fetchColumn();
     } else {
         $version = dmDb::pdo('SELECT v.number FROM version v WHERE v.is_active = ? ORDER BY v.position ASC LIMIT 1', array(true))->fetchColumn();
     }
     return $this->renderText($version);
 }
开发者ID:Regmaya,项目名称:diem-project,代码行数:9,代码来源:actions.class.php

示例2: preTransform

 protected function preTransform($text)
 {
     $text = parent::preTransform($text);
     if (strpos($text, '[/code]')) {
         $text = preg_replace_callback('#\\[code\\s?(\\w*)\\]((?:\\n|.)*)\\n\\[/code\\]#uU', array($this, 'formatCode'), $text);
     }
     if (strpos($text, '%latest_diem_version%')) {
         $version = dmDb::pdo('SELECT v.number FROM version v INNER JOIN branch b ON v.branch_id = b.id AND b.number = ? WHERE v.is_active = ? ORDER BY v.position ASC LIMIT 1', array('5.0', true))->fetchColumn();
         $text = str_replace('%latest_diem_version%', $version, $text);
     }
     if (strpos($text, '%latest_diem_download_url%')) {
         $version = dmDb::query('Version v')->innerJoin('v.Branch b')->where('b.number = ?', '5.0')->andWhere('v.is_active = ?', true)->orderBy('v.position ASC')->fetchOne();
         $text = str_replace('%latest_diem_download_url%', $this->helper->link($version->downloadUrl)->getAbsoluteHref(), $text);
     }
     return $text;
 }
开发者ID:Regmaya,项目名称:diem-project,代码行数:16,代码来源:myGeshiMarkdown.php

示例3: removeOldLocks

 public function removeOldLocks()
 {
     dmDb::pdo(sprintf('DELETE FROM %s WHERE time < ?', $this->getTableName()), array($_SERVER['REQUEST_TIME'] - 10 * sfConfig::get('dm_locks_timeout', 10)));
 }
开发者ID:theolymp,项目名称:diem,代码行数:4,代码来源:PluginDmLockTable.class.php

示例4: getData

 public function getData($tableName)
 {
     return dmDb::pdo('SELECT * FROM ' . $tableName, array(), $this->conn)->fetchAll(Doctrine::FETCH_ASSOC);
 }
开发者ID:Regmaya,项目名称:diem-project,代码行数:4,代码来源:migrateToI18nTask.class.php

示例5: getParentSlugs

    protected function getParentSlugs($module)
    {
        if ($module->hasListPage()) {
            $parentPageModuleKey = $module->getKey();
            $parentPageActionKey = 'list';
        } elseif ($parentModule = $module->getNearestAncestorWithPage()) {
            $parentPageModuleKey = $parentModule->getKey();
            $parentPageActionKey = 'show';
        } else {
            throw new dmException(sprintf('can not identify parent module for %s module', $module));
        }
        $parentSlugResults = dmDb::pdo('SELECT t.id, t.slug
FROM dm_page p, dm_page_translation t
WHERE p.module = ? AND p.action = ? AND p.id = t.id AND t.lang = ?', array($parentPageModuleKey, $parentPageActionKey, $this->culture))->fetchAll(PDO::FETCH_NUM);
        $parentSlugs = array();
        foreach ($parentSlugResults as $psr) {
            $parentSlugs[$psr[0]] = $psr[1];
        }
        unset($parentSlugsResult);
        return $parentSlugs;
    }
开发者ID:eXtreme,项目名称:diem,代码行数:21,代码来源:dmSeoSynchronizer.php

示例6: getAvailableIdsByLocalAlias

 protected function getAvailableIdsByLocalAlias(dmDoctrineTable $refTable)
 {
     $availableIds = array();
     foreach ($refTable->getRelationHolder()->getLocals() as $relationAlias => $relation) {
         $tmp = dmDb::pdo('SELECT t.id FROM ' . $relation->getTable()->getTableName() . ' t')->fetchAll(PDO::FETCH_NUM);
         if (empty($tmp)) {
             throw new dmRecordException();
         }
         foreach ($tmp as $t) {
             $availableIds[$relationAlias][$t[0]] = $t[0];
         }
     }
     return $availableIds;
 }
开发者ID:theolymp,项目名称:diem,代码行数:14,代码来源:dmTableLoremizer.php

示例7: getParentRecordIds

 protected function getParentRecordIds(dmProjectModule $module, dmProjectModule $parentModule)
 {
     /*
      * if parent is local relation for module,
      * we can prepare parent records
      */
     if ($module->hasLocal($parentModule)) {
         $local = $module->getTable()->getRelationHolder()->getLocalByClass($parentModule->getModel())->getLocal();
         $query = sprintf('SELECT r.id, r.%s FROM %s r WHERE EXISTS (SELECT page.id FROM dm_page page WHERE page.module = ? AND page.action = ? AND page.record_id = r.%s)', $local, $module->getTable()->getTableName(), $local);
         $_parentRecordIds = dmDb::pdo($query, array($parentModule->getKey(), 'show'))->fetchAll(PDO::FETCH_NUM);
         $parentRecordIds = array();
         foreach ($_parentRecordIds as $_parentRecordId) {
             $parentRecordIds[$_parentRecordId[0]] = $_parentRecordId[1];
         }
     } elseif ($module->hasAssociation($parentModule)) {
         $association = $module->getTable()->getRelationHolder()->getAssociationByClass($parentModule->getModel());
         $query = sprintf('SELECT association.%s, association.%s FROM %s association WHERE EXISTS (SELECT page.id FROM dm_page page WHERE page.module = ? AND page.action = ? AND page.record_id = association.%s) GROUP BY association.%s', $association->getForeign(), $association->getLocal(), $association->getAssociationTable()->getTableName(), $association->getForeign(), $association->getLocal());
         $_parentRecordIds = dmDb::pdo($query, array($parentModule->getKey(), 'show'))->fetchAll(PDO::FETCH_NUM);
         $parentRecordIds = array();
         foreach ($_parentRecordIds as $value) {
             $parentRecordIds[$value[1]] = $value[0];
         }
     } else {
         $parentRecordIds = false;
     }
     return $parentRecordIds;
 }
开发者ID:rafix,项目名称:diem,代码行数:27,代码来源:dmPageSynchronizer.php

示例8: load

 public static function load($useCache = true)
 {
     if (!self::$culture) {
         if (class_exists('dmContext', false) && dmContext::hasInstance() && ($user = dmContext::getInstance()->getUser())) {
             self::$culture = $user->getCulture();
         } else {
             self::$culture = sfConfig::get('sf_default_culture');
         }
     }
     try {
         if (self::$culture == sfConfig::get('sf_default_culture')) {
             $results = dmDb::pdo('SELECT s.name, t.value, t.lang FROM dm_setting s LEFT JOIN dm_setting_translation t ON t.id=s.id AND t.lang = ?', array(self::$culture))->fetchAll(PDO::FETCH_NUM);
         } else {
             $results = dmDb::pdo('SELECT s.name, t.value, t.lang FROM dm_setting s LEFT JOIN dm_setting_translation t ON t.id=s.id AND t.lang IN (?, ?)', array(self::$culture, sfConfig::get('sf_default_culture')))->fetchAll(PDO::FETCH_NUM);
         }
     } catch (PDOException $e) {
         $results = array();
     } catch (Doctrine_Connection_Exception $e) {
         $results = array();
     }
     self::$config = array();
     foreach ($results as $result) {
         if (!isset(self::$config[$result[0]]) || isset(self::$config[$result[0]]) && $result[2] == self::$culture) {
             self::$config[$result[0]] = $result[1];
         }
     }
     unset($results);
     self::$loaded = true;
 }
开发者ID:theolymp,项目名称:diem,代码行数:29,代码来源:dmConfig.php

示例9: load

 public static function load($useCache = true)
 {
     if ($useCache && file_exists(self::getCacheFileName())) {
         require_once self::getCacheFileName();
     } else {
         if (sfConfig::has('dm_i18n_cultures')) {
             $cultures = sfConfig::get('dm_i18n_cultures');
         } else {
             $tmp = sfYaml::load(file_get_contents(dmOs::join(sfConfig::get('sf_config_dir'), 'dm/config.yml')));
             $cultures = $tmp['all']['i18n']['cultures'];
         }
         $results = dmDb::pdo(sprintf('SELECT s.name, s.type, t.value, t.default_value, t.lang FROM dm_setting s LEFT JOIN dm_setting_translation t ON t.id=s.id AND t.lang IN (\'%s\')', implode('\', \'', $cultures)))->fetchAll(PDO::FETCH_NUM);
         $config = array();
         foreach ($results as $result) {
             $value = $result[2] != '' ? $result[2] : $result[3];
             switch ($result[1]) {
                 case 'boolean':
                     if ($value == '1') {
                         $value = true;
                     } else {
                         $value = false;
                     }
                     break;
                 case 'number':
                     $value = floatval($value);
                     break;
                 case 'integer':
                     $value = intval($value);
                     break;
             }
             // sfConfig::set(sprintf('dm_dmConfig_cache_%s_%s', $result[4], $result[0]), $value);
             // $config[sprintf('dm_dmConfig_cache_%s_%s', $result[4], $result[0])] = $value;
             $config[$result[0]][$result[4]] = $value;
         }
         unset($results);
         self::toMemory($config, $cultures);
         self::dump();
     }
     self::$loaded = true;
 }
开发者ID:runopencode,项目名称:diem-extended,代码行数:40,代码来源:dmConfig.php

示例10: isValidSource

 /**
  * Checks if a particular catalogue+variant exists in the database.
  *
  * @param string $variant catalogue+variant
  * @return boolean true if the catalogue+variant is in the database, false otherwise.
  */
 public function isValidSource($variant)
 {
     $result = dmDb::pdo('SELECT EXISTS(SELECT 1 FROM ' . $this->catalogueTable . ' WHERE name = ?)', array($variant))->fetch(PDO::FETCH_NUM);
     return $result[0];
 }
开发者ID:theolymp,项目名称:diem,代码行数:11,代码来源:sfMessageSource_dm.php


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