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


PHP DBManager::supports方法代码示例

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


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

示例1: createCustomTable

 /**
  * Creates the custom table with an id of id_c.
  *
  * @param bool $execute
  * @return string
  */
 public function createCustomTable($execute = true)
 {
     $out = '';
     if (!$this->db->tableExists($this->bean->table_name . '_cstm')) {
         $GLOBALS['log']->debug('creating custom table for ' . $this->bean->table_name);
         $idDef = array('id_c' => array('name' => 'id_c', 'type' => 'id', 'required' => 1));
         $idIdx = array('id' => array('name' => $this->bean->table_name . '_cstm_pk', 'type' => 'primary', 'fields' => array('id_c')));
         $query = $this->db->createTableSQLParams($this->bean->table_name . '_cstm', $idDef, $idIdx);
         if (!$this->db->supports('inline_keys')) {
             $indicesArr = $this->db->getConstraintSql($idIdx, $this->bean->table_name . '_cstm');
         } else {
             $indicesArr = array();
         }
         if ($execute) {
             $this->db->query($query);
             if (!empty($indicesArr)) {
                 foreach ($indicesArr as $idxq) {
                     $this->db->query($idxq);
                 }
             }
         }
         $out = $query . "\n";
         if (!empty($indicesArr)) {
             $out .= implode("\n", $indicesArr) . "\n";
         }
         $out .= $this->add_existing_custom_fields($execute);
     }
     return $out;
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:35,代码来源:DynamicField.php

示例2: testGetAffectedRowCount

 public function testGetAffectedRowCount()
 {
     if (!$this->_db->supports("affected_rows")) {
         $this->markTestSkipped('Skipping, backend doesn\'t support affected rows');
     }
     $beanIds = $this->_createRecords(1);
     $result = $this->_db->query("DELETE From contacts where id = '{$beanIds[0]}'");
     $this->assertEquals(1, $this->_db->getAffectedRowCount($result));
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:9,代码来源:DBManagerTest.php

示例3: process_order_by

 /**
  * Prefixes column names with this bean's table name.
  *
  * @param string $order_by  Order by clause to be processed
  * @param SugarBean $submodule name of the module this order by clause is for
  * @param boolean $suppress_table_name Whether table name should be suppressed
  * @param array $field_map Map of bean fields to query columns
  * @return string Processed order by clause
  *
  * Internal function, do not override.
  * @deprecated Use SugarQuery & $this->fetchFromQuery() instead
  */
 public function process_order_by($order_by, $submodule = null, $suppress_table_name = false, $field_map = array())
 {
     if (empty($order_by)) {
         return $order_by;
     }
     //submodule is empty,this is for list object in focus
     if (empty($submodule)) {
         $bean_queried = $this;
     } else {
         //submodule is set, so this is for subpanel, use submodule
         $bean_queried = $submodule;
     }
     $raw_elements = explode(',', $order_by);
     $valid_elements = array();
     foreach ($raw_elements as $key => $value) {
         $is_valid = false;
         //value might have ascending and descending decorations
         $list_column = preg_split('/\\s/', trim($value), 2);
         $list_column = array_map('trim', $list_column);
         $list_column_name = $list_column[0];
         // check if it contains table name, eg tasks.name
         if (($pos = strpos($list_column_name, ".")) !== false) {
             $list_column_name = substr($list_column_name, $pos + 1);
         }
         if (isset($bean_queried->field_defs[$list_column_name])) {
             $field_defs = $bean_queried->field_defs[$list_column_name];
             $source = isset($field_defs['source']) ? $field_defs['source'] : 'db';
             if (empty($field_defs['table']) && !$suppress_table_name) {
                 if ($source == 'db') {
                     $list_column[0] = $bean_queried->table_name . '.' . $list_column_name;
                 } elseif ($source == 'custom_fields') {
                     $list_column[0] = $bean_queried->table_name . '_cstm.' . $list_column_name;
                 }
             }
             // Bug 38803 - Use CONVERT() function when doing an order by on ntext, text, and image fields
             if ($source != 'non-db' && $this->db->isTextType($this->db->getFieldType($bean_queried->field_defs[$list_column_name]))) {
                 $list_column[0] = $this->db->convert($list_column[0], "text2char");
             }
             $is_valid = true;
             if (isset($list_column[1])) {
                 switch (strtolower($list_column[1])) {
                     case 'asc':
                     case 'desc':
                         break;
                     default:
                         $GLOBALS['log']->debug("process_order_by: ({$list_column['1']}) is not a valid order.");
                         unset($list_column[1]);
                         break;
                 }
             }
         } else {
             $GLOBALS['log']->debug("process_order_by: ({$list_column['0']}) does not have a vardef entry.");
         }
         if ($is_valid) {
             // Determine order by direction. Will be the same for multiple columns.
             $order = isset($list_column[1]) ? $list_column[1] : '';
             if (isset($field_map[$list_column_name])) {
                 foreach ($field_map[$list_column_name] as $field) {
                     $valid_elements[$field] = $field . ' ' . $order;
                 }
             } else {
                 $valid_elements[$list_column[0]] = implode(' ', $list_column);
             }
             // Apply `ORDER BY` stability if not implied by db backend
             if (!$this->db->supports('order_stability')) {
                 if ($suppress_table_name) {
                     $stableCol = 'id';
                 } else {
                     $stableCol = $bean_queried->getTableName() . '.id';
                 }
                 $valid_elements[$stableCol] = "{$stableCol} {$order}";
             }
         }
     }
     return implode(', ', $valid_elements);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:88,代码来源:SugarBean.php

示例4: supports

 /**
  * Check if this DB supports certain capability
  * See $this->capabilities for the list
  * @param string $cap
  * @return bool
  */
 public function supports($cap)
 {
     if ($cap == 'case_insensitive') {
         return !empty($GLOBALS['sugar_config']['oracle_enable_ci']);
     }
     return parent::supports($cap);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:13,代码来源:OracleManager.php

示例5:

 function execute_query($query_name = 'query', $result_name = 'result', $row_count_name = 'row_count', $row_start_name = 'row_start', $row_end_name = 'row_end', $limit = false)
 {
     // FIXME: needs DB-independent code here
     if ($limit) {
         $start_offset = $this->report_offset;
         if (!$this->db->supports('select_rows')) {
             if ($start_offset > 0) {
                 $start_offset++;
             }
         }
         $this->{$result_name} = $this->db->limitQuery($this->{$query_name}, $start_offset, $this->report_max, true, "Error executing query ");
     } else {
         $this->{$result_name} = $this->db->query($this->{$query_name}, true, "Error executing query ");
     }
     if (!empty($row_count_name) && empty($this->{$row_count_name})) {
         $this->{$row_count_name} = $this->report_offset;
         $this->{$row_end_name} = $this->report_max;
         if ($limit && $this->total_count < $this->{$row_end_name} + $this->{$row_count_name}) {
             $this->{$row_end_name} = $this->total_count - $this->{$row_count_name};
         }
         if ($this->{$row_count_name} > 0) {
             $this->{$row_start_name} = 1;
         }
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:25,代码来源:Report.php


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