Merge remote branch 'origin/master'

This commit is contained in:
Pootle server
2011-01-08 20:40:08 +01:00
6 changed files with 47 additions and 11 deletions

View File

@@ -134,6 +134,7 @@
thanks to erickoh75 - erickoh75
- patch #3150164 [structure] Ordering by size gives incorrect results,
thanks to Madhura Jayaratne - madhuracj
- bug #3153409 [core] 0 row(s) affected
3.3.9.0 (2011-01-03)
- bug [doc] Fix references to MySQL doc

View File

@@ -69,8 +69,8 @@ require_once './libraries/dbi/' . $GLOBALS['cfg']['Server']['extension'] . '.dbi
/**
* Common Functions
*/
function PMA_DBI_query($query, $link = null, $options = 0) {
$res = PMA_DBI_try_query($query, $link, $options)
function PMA_DBI_query($query, $link = null, $options = 0, $cache_affected_rows = true) {
$res = PMA_DBI_try_query($query, $link, $options, $cache_affected_rows)
or PMA_mysqlDie(PMA_DBI_getError($link), $query);
return $res;
}

View File

@@ -154,7 +154,7 @@ function PMA_DBI_select_db($dbname, $link = null)
* @param integer $options
* @return mixed
*/
function PMA_DBI_try_query($query, $link = null, $options = 0)
function PMA_DBI_try_query($query, $link = null, $options = 0, $cache_affected_rows = true)
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
@@ -175,6 +175,10 @@ function PMA_DBI_try_query($query, $link = null, $options = 0)
$r = mysql_query($query, $link);
}
if ($cache_affected_rows) {
$GLOBALS['cached_affected_rows'] = PMA_DBI_affected_rows($link, $get_from_cache = false);
}
if ($GLOBALS['cfg']['DBG']['sql']) {
$time = microtime(true) - $time;
@@ -398,7 +402,16 @@ function PMA_DBI_insert_id($link = null)
return PMA_DBI_fetch_value('SELECT LAST_INSERT_ID();', 0, 0, $link);
}
function PMA_DBI_affected_rows($link = null)
/**
* returns the number of rows affected by last query
*
* @uses $GLOBALS['userlink']
* @uses mysql_affected_rows()
* @param object mysql $link the mysql object
* @param boolean $get_from_cache
* @return string integer
*/
function PMA_DBI_affected_rows($link = null, $get_from_cache = true)
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
@@ -407,8 +420,13 @@ function PMA_DBI_affected_rows($link = null)
return false;
}
}
if ($get_from_cache) {
return $GLOBALS['cached_affected_rows'];
} else {
return mysql_affected_rows($link);
}
}
/**
* @todo add missing keys like in from mysqli_query (orgname, orgtable, flags, decimals)

View File

@@ -172,9 +172,10 @@ function PMA_DBI_select_db($dbname, $link = null)
* @param string $query query to execute
* @param object mysqli $link mysqli object
* @param integer $options
* @param boolean $cache_affected_rows
* @return mixed true, false or result object
*/
function PMA_DBI_try_query($query, $link = null, $options = 0)
function PMA_DBI_try_query($query, $link = null, $options = 0, $cache_affected_rows = true)
{
if ($options == ($options | PMA_DBI_QUERY_STORE)) {
$method = MYSQLI_STORE_RESULT;
@@ -196,6 +197,11 @@ function PMA_DBI_try_query($query, $link = null, $options = 0)
$time = microtime(true);
}
$r = mysqli_query($link, $query, $method);
if ($cache_affected_rows) {
$GLOBALS['cached_affected_rows'] = PMA_DBI_affected_rows($link, $get_from_cache = false);
}
if ($GLOBALS['cfg']['DBG']['sql']) {
$time = microtime(true) - $time;
@@ -455,9 +461,10 @@ function PMA_DBI_insert_id($link = '')
* @uses $GLOBALS['userlink']
* @uses mysqli_affected_rows()
* @param object mysqli $link the mysqli object
* @param boolean $get_from_cache
* @return string integer
*/
function PMA_DBI_affected_rows($link = null)
function PMA_DBI_affected_rows($link = null, $get_from_cache = true)
{
if (empty($link)) {
if (isset($GLOBALS['userlink'])) {
@@ -466,8 +473,12 @@ function PMA_DBI_affected_rows($link = null)
return false;
}
}
if ($get_from_cache) {
return $GLOBALS['cached_affected_rows'];
} else {
return mysqli_affected_rows($link);
}
}
/**
* returns metainfo for fields in $result

View File

@@ -22,10 +22,16 @@ if (! defined('PHPMYADMIN')) {
*/
function PMA_query_as_controluser($sql, $show_error = true, $options = 0)
{
// Avoid caching of the number of rows affected; for example, this function
// is called for tracking purposes but we want to display the correct number
// of rows affected by the original query, not by the query generated for
// tracking.
$cache_affected_rows = false;
if ($show_error) {
$result = PMA_DBI_query($sql, $GLOBALS['controllink'], $options);
$result = PMA_DBI_query($sql, $GLOBALS['controllink'], $options, $cache_affected_rows);
} else {
$result = @PMA_DBI_try_query($sql, $GLOBALS['controllink'], $options);
$result = @PMA_DBI_try_query($sql, $GLOBALS['controllink'], $options, $cache_affected_rows);
} // end if... else...
if ($result) {

View File

@@ -363,7 +363,7 @@ foreach ($query as $single_query) {
if (! $result) {
$error_messages[] = PMA_DBI_getError();
} else {
// the following is a real assignment:
// The next line contains a real assignment, it's not a typo
if ($tmp = @PMA_DBI_affected_rows()) {
$total_affected_rows += $tmp;
}