當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。