當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBManager::modifyIndexes方法代碼示例

本文整理匯總了PHP中DBManager::modifyIndexes方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBManager::modifyIndexes方法的具體用法?PHP DBManager::modifyIndexes怎麽用?PHP DBManager::modifyIndexes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DBManager的用法示例。


在下文中一共展示了DBManager::modifyIndexes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testModifyMultiIndexesByMultiQuery

 public function testModifyMultiIndexesByMultiQuery()
 {
     $tableName = 'test17_' . mt_rand();
     $fields = array('foo' => array('name' => 'foo', 'type' => 'varchar', 'len' => '255'), 'bar' => array('name' => 'bar', 'type' => 'varchar', 'len' => '255'));
     $indexes = array('idx_foo' => array('name' => 'idx_foo', 'type' => 'index', 'fields' => array('foo')), 'idx_bar' => array('name' => 'idx_bar', 'type' => 'index', 'fields' => array('bar')));
     $this->createTableParams($tableName, $fields, $indexes);
     $indexesDB = $this->_db->get_indices($tableName);
     $this->assertEquals($indexes, $indexesDB, 'Indexes are incorrect');
     $indexesNew = $indexes;
     $indexesNew['idx_foo']['fields'] = array('bar');
     $indexesNew['idx_bar']['fields'] = array('foo');
     $queries = $this->_db->modifyIndexes($tableName, $indexesNew, false);
     $queries = explode(";\n", rtrim(trim($queries), ';'));
     $this->_db->query($queries);
     $indexesDB = $this->_db->get_indices($tableName);
     $this->assertEquals($indexesNew, $indexesDB, 'Indexes are incorrect');
 }
開發者ID:delkyd,項目名稱:sugarcrm_dev,代碼行數:17,代碼來源:DBManagerTest.php

示例2: testModifyIndexes

 public function testModifyIndexes()
 {
     //TODO Fix test with normal index inspection
     $this->markTestIncomplete('TODO Reimplement test not using compareIndexInTables.');
     $tablename1 = 'test21_' . mt_rand();
     $this->createTableParams($tablename1, array('foo' => array('name' => 'foo', 'type' => 'varchar', 'len' => '255'), 'foobar' => array('name' => 'foobar', 'type' => 'varchar', 'len' => '255')), array(array('name' => 'idx_' . $tablename1, 'type' => 'index', 'fields' => array('foo'))));
     $tablename2 = 'test22_' . mt_rand();
     $this->createTableParams($tablename2, array('foo' => array('name' => 'foo', 'type' => 'varchar', 'len' => '255'), 'foobar' => array('name' => 'foobar', 'type' => 'varchar', 'len' => '255')), array(array('name' => 'idx_' . $tablename2, 'type' => 'index', 'fields' => array('foobar'))));
     $res = $this->_db->compareIndexInTables('idx_foo', $tablename1, $tablename2);
     $this->assertEquals($res['msg'], 'no_match');
     $this->_db->modifyIndexes($tablename2, array(array('name' => 'idx_foo', 'type' => 'index', 'fields' => array('foo'))), false);
     $res = $this->_db->compareIndexInTables('idx_foo', $tablename1, $tablename2);
     $this->assertEquals($res['msg'], 'no_match');
     $this->_db->modifyIndexes($tablename2, array(array('name' => 'idx_foo', 'type' => 'index', 'fields' => array('foo'))));
     $res = $this->_db->compareIndexInTables('idx_foo', $tablename1, $tablename2);
     $this->assertEquals($res['msg'], 'match');
     $this->dropTableName($tablename1);
     $this->dropTableName($tablename2);
 }
開發者ID:newLoki,項目名稱:sugarcrm_dev,代碼行數:19,代碼來源:DBManagerTest.php


注:本文中的DBManager::modifyIndexes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。