Connection::getObject(), Errores solucionados
This commit is contained in:
parent
dc88a10f28
commit
363f1718be
|
@ -142,13 +142,32 @@ class Connection
|
||||||
|
|
||||||
return NULL;
|
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.
|
* Gets the first row value of the first column from a result.
|
||||||
*
|
*
|
||||||
* @param resource $result The database 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)
|
function getValueFromResult ($result)
|
||||||
{
|
{
|
||||||
|
@ -181,6 +200,20 @@ class Connection
|
||||||
return $this->getRowFromResult ($result);
|
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.
|
* 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.
|
* Initial Release.
|
||||||
|
|
||||||
|
|
10
lib/app.php
10
lib/app.php
|
@ -49,6 +49,16 @@ class App
|
||||||
return $this->name;
|
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
|
* Initializes Application. Should be the first called function in any
|
||||||
* application that uses this class.
|
* application that uses this class.
|
||||||
|
|
|
@ -52,7 +52,7 @@ abstract class Method
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
foreach ($params as $param)
|
foreach ($params as $param)
|
||||||
if (empty ($map[$param]))
|
if (!isset ($map[$param]))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue