Bug #3153409 [core] 0 row(s) affected
This commit is contained in:
@@ -10,6 +10,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
|
||||
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
|
||||
|
@@ -79,8 +79,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;
|
||||
}
|
||||
|
@@ -155,7 +155,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'])) {
|
||||
@@ -176,6 +176,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;
|
||||
|
||||
@@ -402,7 +406,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'])) {
|
||||
@@ -411,7 +424,12 @@ function PMA_DBI_affected_rows($link = null)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($get_from_cache) {
|
||||
return $GLOBALS['cached_affected_rows'];
|
||||
} else {
|
||||
return mysql_affected_rows($link);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -175,9 +175,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;
|
||||
@@ -199,6 +200,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;
|
||||
|
||||
@@ -460,9 +466,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'])) {
|
||||
@@ -471,7 +478,11 @@ function PMA_DBI_affected_rows($link = null)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($get_from_cache) {
|
||||
return $GLOBALS['cached_affected_rows'];
|
||||
} else {
|
||||
return mysqli_affected_rows($link);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -29,10 +29,16 @@ require_once './libraries/Table.class.php';
|
||||
*/
|
||||
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) {
|
||||
|
@@ -357,7 +357,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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user