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


PHP FabrikString::safeQuoteName方法代码示例

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


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

示例1: getOrderBy

 /**
  * Get options order by
  *
  * @param   string               $view   View mode '' or 'filter'
  * @param   JDatabaseQuery|bool  $query  Set to false to return a string
  *
  * @return  string  order by statement
  */
 protected function getOrderBy($view = '', $query = false)
 {
     $params = $this->getParams();
     $orderBy = $params->get('notes_order_element');
     if ($orderBy == '') {
         return $query ? $query : '';
     } else {
         $order = FabrikString::safeQuoteName($params->get('join_db_name') . '.' . $orderBy) . ' ' . $params->get('notes_order_dir', 'ASC');
         if ($query) {
             $query->order($order);
             return $query;
         }
         return " ORDER BY " . $order;
     }
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:23,代码来源:notes.php

示例2: createRepeatElement

 /**
  * If repeated element we need to make a joined db table to store repeated data in
  *
  * @param   object $elementModel element model
  * @param   object $row          element item
  *
  * @return  void
  */
 public function createRepeatElement($elementModel, $row)
 {
     if (!$elementModel->isJoin()) {
         return;
     }
     $row->name = str_replace('`', '', $row->name);
     $listModel = $elementModel->getListModel();
     $groupModel = $elementModel->getGroupModel();
     $tableName = $this->getRepeatElementTableName($elementModel, $row);
     // Create db table!
     $formModel = $elementModel->getForm();
     $db = $listModel->getDb();
     $desc = $elementModel->getFieldDescription();
     $name = $db->quoteName($row->name);
     $db->setQuery('CREATE TABLE IF NOT EXISTS ' . $db->quoteName($tableName) . ' ( id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, parent_id INT(11), ' . $name . ' ' . $desc . ', ' . $db->quoteName('params') . ' TEXT );');
     $db->execute();
     // Remove previous join records if found
     if ((int) $row->id !== 0) {
         $jdb = FabrikWorker::getDbo(true);
         $query = $jdb->getQuery(true);
         $query->delete('#__{package}_joins')->where('element_id = ' . (int) $row->id);
         $jdb->setQuery($query);
         $jdb->execute();
     }
     // Create or update fabrik join
     if ($groupModel->isJoin()) {
         $joinFromTable = $groupModel->getJoinModel()->getJoin()->table_join;
     } else {
         $joinFromTable = $listModel->getTable()->db_table_name;
     }
     $data = array('list_id' => $listModel->getTable()->id, 'element_id' => $row->id, 'join_from_table' => $joinFromTable, 'table_join' => $tableName, 'table_key' => $row->name, 'table_join_key' => 'parent_id', 'join_type' => 'left');
     $join = $this->getTable('join');
     $join->load(array('element_id' => $data['element_id']));
     $opts = new stdClass();
     $opts->type = 'repeatElement';
     $opts->pk = FabrikString::safeQuoteName($tableName . '.id');
     $data['params'] = json_encode($opts);
     $join->bind($data);
     $join->store();
     $fieldName = $tableName . '___parent_id';
     $listModel->addIndex($fieldName, 'parent_fk', 'INDEX', '');
     $fields = $listModel->getDBFields($tableName, 'Field');
     $field = FArrayHelper::getValue($fields, $row->name, false);
     switch ($field->BaseType) {
         case 'VARCHAR':
             $size = (int) $field->BaseLength < 10 ? $field->BaseLength : 10;
             break;
         case 'INT':
         case 'DATETIME':
         default:
             $size = '';
             break;
     }
     $fieldName = $tableName . '___' . $row->name;
     $listModel->addIndex($fieldName, 'repeat_el', 'INDEX', $size);
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:64,代码来源:element.php


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