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