Jeff PHP framework  0.99
Modular, extensible, OOP, MVC, lightweight php framework designed to ease the programmers in the development of web applications.
db.factory.php
Go to the documentation of this file.
00001 <?php
00027 require_once('interface.db.php');
00028 
00038 abstract class db extends singleton {
00039         
00043         private static $_db_host = DB_HOST;
00044 
00048         private static $_db_user = DB_USER;
00049 
00053         private static $_db_pass = DB_PASSWORD;
00054 
00058         private static $_db_dbname = DB_DBNAME;
00059 
00063         private static $_db_charset = DB_CHARSET;
00064 
00068         private static $_db_schema = DB_SCHEMA;
00069 
00076         public static function instance() {
00077                 
00078                 $class = get_class();
00079 
00080                 // singleton, return always the same instance
00081                 if(array_key_exists($class, self::$_instances) === false) {
00082 
00083                         if(DBMS=='mysql') { 
00084                                 self::$_instances[$class] = new mysql(
00085                                         array(
00086                                                 "connect"=>true,
00087                                                 "host"=>self::$_db_host,
00088                                                 "user"=>self::$_db_user,
00089                                                 "password"=>self::$_db_pass,
00090                                                 "db_name"=>self::$_db_dbname,
00091                                                 "charset"=>self::$_db_charset
00092                                         )
00093                                 );
00094                         }
00095                 }
00096 
00097                 return self::$_instances[$class];
00098 
00099         }
00100 
00101 }
00102 
00103 ?>