本文整理汇总了PHP中PMA_analyzeWhereClauses函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_analyzeWhereClauses函数的具体用法?PHP PMA_analyzeWhereClauses怎么用?PHP PMA_analyzeWhereClauses使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_analyzeWhereClauses函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_getStuffForEditMode
/**
* Retrieve the values for pma edit mode
*
* @param type $where_clause where clauses
* @param type $table name of the table
* @param type $db name of the database
*
* @return type containing insert_mode,whereClauses, result array
* where_clauses_array and found_unique_key boolean value
*/
function PMA_getStuffForEditMode($where_clause, $table, $db)
{
if (isset($where_clause)) {
$where_clause_array = PMA_getWhereClauseArray($where_clause);
list($whereClauses, $resultArray, $rowsArray, $found_unique_key) = PMA_analyzeWhereClauses($where_clause_array, $table, $db);
return array(false, $whereClauses, $resultArray, $rowsArray, $where_clause_array, $found_unique_key);
} else {
list($results, $row) = PMA_loadFirstRowInEditMode($table, $db);
return array(true, null, $results, $row, null, false);
}
}
示例2: PMA_determineInsertOrEdit
/**
* Function to determine Insert/Edit rows
*
* @param string $where_clause where clause
* @param string $db current database
* @param string $table current table
*
* @return mixed
*/
function PMA_determineInsertOrEdit($where_clause, $db, $table)
{
if (isset($_REQUEST['where_clause'])) {
$where_clause = $_REQUEST['where_clause'];
}
if (isset($_SESSION['edit_next'])) {
$where_clause = $_SESSION['edit_next'];
unset($_SESSION['edit_next']);
$after_insert = 'edit_next';
}
if (isset($_REQUEST['ShowFunctionFields'])) {
$GLOBALS['cfg']['ShowFunctionFields'] = $_REQUEST['ShowFunctionFields'];
}
if (isset($_REQUEST['ShowFieldTypesInDataEditView'])) {
$GLOBALS['cfg']['ShowFieldTypesInDataEditView'] = $_REQUEST['ShowFieldTypesInDataEditView'];
}
if (isset($_REQUEST['after_insert'])) {
$after_insert = $_REQUEST['after_insert'];
}
if (isset($where_clause)) {
// we are editing
$insert_mode = false;
$where_clause_array = PMA_getWhereClauseArray($where_clause);
list($where_clauses, $result, $rows, $found_unique_key) = PMA_analyzeWhereClauses($where_clause_array, $table, $db);
} else {
// we are inserting
$insert_mode = true;
$where_clause = null;
list($result, $rows) = PMA_loadFirstRow($table, $db);
$where_clauses = null;
$where_clause_array = array();
$found_unique_key = false;
}
// Copying a row - fetched data will be inserted as a new row,
// therefore the where clause is needless.
if (isset($_REQUEST['default_action']) && $_REQUEST['default_action'] === 'insert') {
$where_clause = $where_clauses = null;
}
return array($insert_mode, $where_clause, $where_clause_array, $where_clauses, $result, $rows, $found_unique_key, isset($after_insert) ? $after_insert : null);
}
示例3: testAnalyzeWhereClause
/**
* Test for PMA_analyzeWhereClauses
*
* @return void
*/
public function testAnalyzeWhereClause()
{
$clauses = array('a=1', 'b="fo\\o"');
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
$dbi->expects($this->at(0))->method('query')->with('SELECT * FROM `db`.`table` WHERE a=1;', null, PMA_DatabaseInterface::QUERY_STORE)->will($this->returnValue('result1'));
$dbi->expects($this->at(3))->method('query')->with('SELECT * FROM `db`.`table` WHERE b="fo\\o";', null, PMA_DatabaseInterface::QUERY_STORE)->will($this->returnValue('result2'));
$dbi->expects($this->at(1))->method('fetchAssoc')->with('result1')->will($this->returnValue(array('assoc1')));
$dbi->expects($this->at(4))->method('fetchAssoc')->with('result2')->will($this->returnValue(array('assoc2')));
$GLOBALS['dbi'] = $dbi;
$result = PMA_analyzeWhereClauses($clauses, 'table', 'db');
$this->assertEquals(array(array('a=1', 'b="fo\\\\o"'), array('result1', 'result2'), array(array('assoc1'), array('assoc2')), ''), $result);
}
示例4: testAnalyzeWhereClause
/**
* Test for PMA_analyzeWhereClauses
*
* @return void
*/
public function testAnalyzeWhereClause()
{
$clauses = array('a=1', 'b="fo\\o"');
$dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
$dbi->expects($this->exactly(2))->method('query')->willReturnOnConsecutiveCalls('result1', 'result2');
$dbi->expects($this->exactly(2))->method('fetchAssoc')->willReturnOnConsecutiveCalls(array('assoc1'), array('assoc2'));
$GLOBALS['dbi'] = $dbi;
$result = PMA_analyzeWhereClauses($clauses, 'table', 'db');
$this->assertEquals(array(array('a=1', 'b="fo\\\\o"'), array('result1', 'result2'), array(array('assoc1'), array('assoc2')), ''), $result);
}
示例5: PMA_DBI_select_db
*/
$analyzed_sql = PMA_Table::analyzeStructure($db, $table);
/**
* Get the list of the fields of the current table
*/
PMA_DBI_select_db($db);
$table_fields = array_values(PMA_DBI_get_columns($db, $table));
$paramTableDbArray = array($table, $db);
/**
* Determine what to do, edit or insert?
*/
if (isset($where_clause)) {
// we are editing
$insert_mode = false;
$where_clause_array = PMA_getWhereClauseArray($where_clause);
list($where_clauses, $result, $rows, $found_unique_key) = PMA_analyzeWhereClauses($where_clause_array, $table, $db);
} else {
// we are inserting
$insert_mode = true;
$where_clause = null;
list($result, $rows) = PMA_loadFirstRow($table, $db);
$where_clauses = null;
$where_clause_array = null;
$found_unique_key = false;
}
// Copying a row - fetched data will be inserted as a new row,
// therefore the where clause is needless.
if (isset($_REQUEST['default_action']) && $_REQUEST['default_action'] === 'insert') {
$where_clause = $where_clauses = null;
}
// retrieve keys into foreign fields, if any