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


PHP PMA_showEmptyResultMessageOrSetUniqueCondition函数代码示例

本文整理汇总了PHP中PMA_showEmptyResultMessageOrSetUniqueCondition函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_showEmptyResultMessageOrSetUniqueCondition函数的具体用法?PHP PMA_showEmptyResultMessageOrSetUniqueCondition怎么用?PHP PMA_showEmptyResultMessageOrSetUniqueCondition使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: PMA_analyzeWhereClauses

/**
 * Analysing where clauses array
 *
 * @param array  $where_clause_array array of where clauses
 * @param string $table              name of the table
 * @param string $db                 name of the database
 *
 * @return array $where_clauses, $result, $rows
 */
function PMA_analyzeWhereClauses($where_clause_array, $table, $db)
{
    $rows = array();
    $result = array();
    $where_clauses = array();
    $found_unique_key = false;
    foreach ($where_clause_array as $key_id => $where_clause) {
        $local_query = 'SELECT * FROM ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table) . ' WHERE ' . $where_clause . ';';
        $result[$key_id] = $GLOBALS['dbi']->query($local_query, null, PMA_DatabaseInterface::QUERY_STORE);
        $rows[$key_id] = $GLOBALS['dbi']->fetchAssoc($result[$key_id]);
        $where_clauses[$key_id] = str_replace('\\', '\\\\', $where_clause);
        $has_unique_condition = PMA_showEmptyResultMessageOrSetUniqueCondition($rows, $key_id, $where_clause_array, $local_query, $result);
        if ($has_unique_condition) {
            $found_unique_key = true;
        }
    }
    return array($where_clauses, $result, $rows, $found_unique_key);
}
开发者ID:hewenhao2008,项目名称:phpmyadmin,代码行数:27,代码来源:insert_edit.lib.php

示例2: testShowEmptyResultMessageOrSetUniqueCondition

 /**
  * Test for PMA_showEmptyResultMessageOrSetUniqueCondition
  *
  * @return void
  */
 public function testShowEmptyResultMessageOrSetUniqueCondition()
 {
     $temp = new stdClass();
     $temp->orgname = 'orgname';
     $temp->table = 'table';
     $temp->type = 'real';
     $temp->primary_key = 1;
     $meta_arr = array($temp);
     $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->at(0))->method('getFieldsMeta')->with('result1')->will($this->returnValue($meta_arr));
     $GLOBALS['dbi'] = $dbi;
     $result = PMA_showEmptyResultMessageOrSetUniqueCondition(array('1' => array('1' => 1)), 1, array(), 'SELECT', array('1' => 'result1'));
     $this->assertTrue($result);
     // case 2
     $GLOBALS['cfg']['ShowSQL'] = false;
     $responseMock = $this->getMockBuilder('PMA_Response')->disableOriginalConstructor()->setMethods(array('addHtml'))->getMock();
     $response = new ReflectionProperty('PMA_Response', '_instance');
     $response->setAccessible(true);
     $response->setValue(null, $responseMock);
     $result = PMA_showEmptyResultMessageOrSetUniqueCondition(array(false), 0, array('1'), 'SELECT', array('1' => 'result1'));
     $this->assertFalse($result);
 }
开发者ID:kfjihailong,项目名称:phpMyAdmin,代码行数:27,代码来源:PMA_insert_edit_test.php

示例3: PMA_analyzeWhereClauses

/**
 * Analysing where clauses array
 *
 * @param array  $where_clause_array array of where clauses
 * @param string $table              name of the table
 * @param string $db                 name of the database
 *
 * @return array $where_clauses, $result, $rows
 */
function PMA_analyzeWhereClauses($where_clause_array, $table, $db)
{
    $rows = array();
    $result = array();
    $where_clauses = array();
    $found_unique_key = false;
    foreach ($where_clause_array as $key_id => $where_clause) {
        $local_query = 'SELECT * FROM ' . PMA_CommonFunctions::getInstance()->backquote($db) . '.' . PMA_CommonFunctions::getInstance()->backquote($table) . ' WHERE ' . $where_clause . ';';
        $result[$key_id] = PMA_DBI_query($local_query, null, PMA_DBI_QUERY_STORE);
        $rows[$key_id] = PMA_DBI_fetch_assoc($result[$key_id]);
        $where_clauses[$key_id] = str_replace('\\', '\\\\', $where_clause);
        $has_unique_condition = PMA_showEmptyResultMessageOrSetUniqueCondition($rows, $key_id, $where_clause_array, $local_query, $result);
        if ($has_unique_condition) {
            $found_unique_key = true;
        }
    }
    return array($where_clauses, $result, $rows, $found_unique_key);
}
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:27,代码来源:insert_edit.lib.php


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