~ubuntu-branches/ubuntu/lucid/phpmyadmin/lucid

« back to all changes in this revision

Viewing changes to libraries/common.lib.php

  • Committer: Bazaar Package Importer
  • Author(s): Thijs Kinkhorst
  • Date: 2009-12-08 18:35:56 UTC
  • mfrom: (1.2.6 upstream) (36.1.7 lucid)
  • Revision ID: james.westby@ubuntu.com-20091208183556-vr6gh28bmfe1rcps
Tags: 4:3.2.4-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
/**
4
4
 * Misc functions used all over the scripts.
5
5
 *
6
 
 * @version $Id: common.lib.php 12805 2009-08-16 12:59:58Z lem9 $
 
6
 * @version $Id: common.lib.php 13118 2009-11-21 13:22:08Z lem9 $
7
7
 * @package phpMyAdmin
8
8
 */
9
9
 
1911
1911
 *
1912
1912
 * @access  public
1913
1913
 * @author  Michal Cihar (michal@cihar.com) and others...
1914
 
 * @return  string      calculated condition
 
1914
 * @return  array      the calculated condition and whether condition is unique
1915
1915
 */
1916
1916
function PMA_getUniqueCondition($handle, $fields_cnt, $fields_meta, $row, $force_unique=false)
1917
1917
{
2009
2009
    // Correction University of Virginia 19991216:
2010
2010
    // prefer primary or unique keys for condition,
2011
2011
    // but use conjunction of all values if no primary key
 
2012
    $clause_is_unique = true;
2012
2013
    if ($primary_key) {
2013
2014
        $preferred_condition = $primary_key;
2014
2015
    } elseif ($unique_key) {
2015
2016
        $preferred_condition = $unique_key;
2016
2017
    } elseif (! $force_unique) {
2017
2018
        $preferred_condition = $nonprimary_condition;
 
2019
        $clause_is_unique = false;
2018
2020
    }
2019
2021
 
2020
 
    return trim(preg_replace('|\s?AND$|', '', $preferred_condition));
 
2022
    $where_clause = trim(preg_replace('|\s?AND$|', '', $preferred_condition));
 
2023
    return(array($where_clause, $clause_is_unique));
 
2024
 
2021
2025
} // end function
2022
2026
 
2023
2027
/**