Return the number of rows modified by the request
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1226 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -173,7 +173,8 @@ class dblayer extends PDO
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update the key tuple with the provided datas */
|
/** Update the key tuple with the provided datas
|
||||||
|
Return the number of rows modified */
|
||||||
function update ($updatekey, $datas)
|
function update ($updatekey, $datas)
|
||||||
{
|
{
|
||||||
if ($this->db === null)
|
if ($this->db === null)
|
||||||
@@ -186,6 +187,8 @@ class dblayer extends PDO
|
|||||||
if (array_key_exists ($key, $datas))
|
if (array_key_exists ($key, $datas))
|
||||||
$datasOK[$key] = $datas[$key];
|
$datasOK[$key] = $datas[$key];
|
||||||
}
|
}
|
||||||
|
if (count ($datasOK) === 0)
|
||||||
|
throw new Exception (_("Don't receive any field to display"), 501);
|
||||||
|
|
||||||
$req = "UPDATE `".$this->table."` SET ";
|
$req = "UPDATE `".$this->table."` SET ";
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@@ -218,6 +221,7 @@ class dblayer extends PDO
|
|||||||
}
|
}
|
||||||
|
|
||||||
$st->execute ();
|
$st->execute ();
|
||||||
|
return $st->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Delete a tuple identified by its primary key
|
/** Delete a tuple identified by its primary key
|
||||||
|
|||||||
Reference in New Issue
Block a user