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


PHP DBManager::get_indices方法代码示例

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


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

示例1: testGetIndicesContainsPrimary

 public function testGetIndicesContainsPrimary()
 {
     $indices = $this->_db->get_indices('accounts');
     // find if any are primary
     $found = false;
     foreach ($indices as $index) {
         if ($index['type'] == "primary") {
             $found = true;
             break;
         }
     }
     $this->assertTrue($found, 'Primary Key Not Found On Module');
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:13,代码来源:DBManagerTest.php

示例2: testRemovePrimaryKey

 /**
  * @depends testAddPrimaryKey
  */
 public function testRemovePrimaryKey()
 {
     $tablename = 'testConstraints';
     $this->created[$tablename] = true;
     $sql = $this->_db->add_drop_constraint($tablename, array('name' => 'testConstraints_pk', 'type' => 'primary', 'fields' => array('id')), true);
     $result = $this->_db->query($sql);
     $indices = $this->_db->get_indices($tablename);
     // find if any are primary
     $found = false;
     foreach ($indices as $index) {
         if ($index['type'] == "primary") {
             $found = true;
             break;
         }
     }
     $this->assertFalse($found, 'Primary Key Found On Table');
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:20,代码来源:DBManagerTest.php

示例3: testRepairTableParamsAddIndexAndData

 public function testRepairTableParamsAddIndexAndData()
 {
     $tableName = 'test1_' . mt_rand();
     $params = array('foo' => array('name' => 'foo', 'type' => 'varchar', 'len' => '255'), 'bar' => array('name' => 'bar', 'type' => 'int'));
     $index = array('name' => 'test_index', 'type' => 'index', 'fields' => array('foo', 'bar'));
     if ($this->_db->tableExists($tableName)) {
         $this->_db->dropTableName($tableName);
     }
     $this->createTableParams($tableName, $params, array());
     $repair = $this->_db->repairTableParams($tableName, $params, array($index), false);
     $this->assertRegExp('#MISSING INDEX IN DATABASE.*test_index#i', $repair);
     $repair = $this->_db->repairTableParams($tableName, $params, array($index), true);
     $idx = $this->_db->get_indices($tableName);
     $this->assertArrayHasKey('test_index', $idx);
     $this->assertContains('foo', $idx['test_index']['fields']);
     $this->assertContains('bar', $idx['test_index']['fields']);
     $this->dropTableName($tableName);
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:18,代码来源:DBManagerTest.php


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