当前位置: 首页>>代码示例>>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;未经允许,请勿转载。