Ahora getValue y getRow liberan el resultado automaticamente

This commit is contained in:
Juan Ferrer Toribio 2015-08-26 14:24:45 +02:00
parent d6700546ef
commit 439815da0d
2 changed files with 17 additions and 5 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
php-vn-lib (1.1-1) stable; urgency=low php-vn-lib (1.2-1) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -71,8 +71,12 @@ class Conn
{ {
$result = $this->query ($query, $params); $result = $this->query ($query, $params);
if ($result && ($row = $result->fetch_assoc ())) if ($result)
{
$row = $result->fetch_assoc ();
$result->free ();
return $row; return $row;
}
return NULL; return NULL;
} }
@ -87,12 +91,20 @@ class Conn
**/ **/
function getValue ($query, $params = NULL) function getValue ($query, $params = NULL)
{ {
$value = NULL;
$result = $this->query ($query, $params); $result = $this->query ($query, $params);
if ($result && ($row = $result->fetch_row ())) if ($result)
return $row[0]; {
$row = $result->fetch_row ();
if ($row && count ($row) > 0)
$value = $row[0];
$result->free ();
}
return NULL; return $value;
} }
/** /**