This commit is contained in:
ohartl 2016-05-17 23:36:03 +02:00
parent 171f2c7f11
commit 99925c690e

View file

@ -46,7 +46,7 @@ class Database
$this->db = new mysqli($host, $user, $password, $database);
}
catch(mysqli_sql_exception $e){
throw new Exception('Unable to connect to database', 0, $e);
throw new Exception('Unable to connect to the database.', 0, $e);
}
}
}
@ -89,6 +89,9 @@ class Database
* @param string $password
* @param string $database
*
* @throws InvalidArgumentException
* @throws Exception
*
* @codeCoverageIgnore
*/
public static function init($host, $user = null, $password = null, $database = null)
@ -180,6 +183,8 @@ class Database
* @param int $limit
*
* @return bool|mysqli_result
*
* @throws DatabaseException
*/
public function select($table, $conditions = array(), $conditionConnector = 'AND', $orderBy = null, $limit = 0)
{
@ -202,6 +207,8 @@ class Database
* @param array $values
*
* @return mixed
*
* @throws DatabaseException
*/
public function insert($table, $values)
{
@ -228,6 +235,8 @@ class Database
* @param array $values
* @param array $conditions
* @param string $conditionConnector
*
* @throws DatabaseException
*/
public function update($table, $values, $conditions = array(), $conditionConnector = 'AND')
{
@ -260,6 +269,8 @@ class Database
* @param string $conditionConnector
*
* @return int
*
* @throws DatabaseException
*/
public function count($table, $byAttribute, $conditions = array(), $conditionConnector = 'AND')
{
@ -280,7 +291,8 @@ class Database
* @param string $table
* @param string $attribute
* @param mixed $value
* @return bool
*
* @throws DatabaseException
*/
public function delete($table, $attribute, $value)
{