Connection::getObject(), Errores solucionados
This commit is contained in:
parent
dc88a10f28
commit
363f1718be
|
@ -142,13 +142,32 @@ class Connection
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the first row value of the first column from a result.
|
||||
*
|
||||
* @param resource $result The database result
|
||||
*
|
||||
* @return object An object with the first row, %NULL if error
|
||||
**/
|
||||
function getObjectFromResult ($result)
|
||||
{
|
||||
if ($result)
|
||||
{
|
||||
$row = $result->fetch_object ();
|
||||
$result->free ();
|
||||
return $row;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the first row value of the first column from a result.
|
||||
*
|
||||
* @param resource $result The database result
|
||||
*
|
||||
* @return mixed The value or %NULL if error
|
||||
* @return mixed The value or %NULL if error
|
||||
**/
|
||||
function getValueFromResult ($result)
|
||||
{
|
||||
|
@ -181,6 +200,20 @@ class Connection
|
|||
return $this->getRowFromResult ($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the query and gets it's first row.
|
||||
*
|
||||
* @param string $query The SQL query
|
||||
* @param mixed[] $params The query parameters
|
||||
*
|
||||
* @return object An object with the first row, %NULL if error
|
||||
**/
|
||||
function getObject ($query, $params = NULL)
|
||||
{
|
||||
$result = $this->query ($query, $params);
|
||||
return $this->getObjectFromResult ($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the query and gets the first value of the first row.
|
||||
*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
php-vn-lib (1.309-deb8) stable; urgency=low
|
||||
php-vn-lib (2.1.2) stable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
|
|
10
lib/app.php
10
lib/app.php
|
@ -49,6 +49,16 @@ class App
|
|||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configuration object.
|
||||
*
|
||||
* @return The config object
|
||||
**/
|
||||
function getConf ()
|
||||
{
|
||||
return $this->conf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes Application. Should be the first called function in any
|
||||
* application that uses this class.
|
||||
|
|
|
@ -52,7 +52,7 @@ abstract class Method
|
|||
return FALSE;
|
||||
|
||||
foreach ($params as $param)
|
||||
if (empty ($map[$param]))
|
||||
if (!isset ($map[$param]))
|
||||
{
|
||||
return FALSE;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue