Db Class Reference

Inheritance diagram for Db:

mysqli List of all members.

Detailed Description

See mysqli class documentation for details.

Definition at line 37 of file db.php.

Public Member Functions

 __construct ()
 Establishes database connection.
 query ($sql)
 
Exceptions:
Exception On error.


Member Function Documentation

Db::__construct  ) 
 

Establishes database connection.

All data has to be in UTF-8.

Exceptions:
Exception If cannot connect.

Definition at line 44 of file db.php.

References query().

00044                            {
00045       global $mysql_host, $mysql_username, $mysql_password, $mysql_dbname;
00046       parent::__construct($mysql_host, $mysql_username, $mysql_password, $mysql_dbname);
00047       if (mysqli_connect_errno()):
00048         throw new Exception(sprintf("Can't connect to MySQL Server. Errorcode: %s\n", mysqli_connect_error()));
00049       endif;
00050       parent::query("SET NAMES 'utf8'"); // we work in UTF-8
00051     }

Db::query sql  ) 
 

Exceptions:
Exception On error.

Returns:
mysqli_result object.

Definition at line 57 of file db.php.

References query().

00057                          {
00058       $result = parent::query($sql);
00059       if (!$result):
00060         throw new Exception(sprintf("Error in query %s. Error message: %s\n", $sql, $this->error));
00061       endif;
00062       return $result;
00063     }


The documentation for this class was generated from the following file:
Generated on Sat Sep 24 01:26:42 2005 for Easy PHP Framework by  doxygen 1.4.2