Пример #1
0
 public function __construct(array $options)
 {
     //return new parent__construct(postgres string);
     $host = $options['host'];
     $databasename = $options['database'];
     //mysql:host=localhost port=3306 dbname=testdb user=bruce password=mypass
     $str = "mysql:host={$host};port=3306;dbname={$databasename}";
     $options['dns'] = $str;
     parent::__construct($options);
 }
Пример #2
0
 public static function getDBO()
 {
     //get configuration, database specific values and call SomeDatabase::getInstance(array(...fill with driver, host, databasname,etc))
     $conf = SomeFactory::getConfiguration();
     $databaseIsUser = $conf->get('isused', 'database');
     if (!$databaseIsUser) {
         return null;
     }
     $driver = $conf->get('databasedriver', 'database');
     $host = $conf->get('databasehost', 'database');
     $database = $conf->get('database', 'database');
     $dbuser = $conf->get('dbuser', 'database');
     $dbpass = $conf->get('dbpass', 'database');
     someloader('some.database.database');
     return SomeDatabase::getInstance(array('driver' => $driver, 'database' => $database, 'host' => $host, 'dbuser' => $dbuser, 'dbpass' => $dbpass));
 }
Пример #3
0
 public function lastInsertId($sequence)
 {
     return parent::lastInsertId($sequence);
 }