Added AdressDB + AddressDB API
This commit is contained in:
+10
-2
@@ -26,14 +26,22 @@ class FronkDB {
|
||||
|
||||
public static function singleton($host=false,$user=false,$pass=false,$db=false) {
|
||||
$instance_name = $host.$user.$db;
|
||||
if(!isset(self::$instances[$instance_name])) {
|
||||
if(!$instance_name) {
|
||||
$instance_name = "default";
|
||||
}
|
||||
|
||||
if(!isset(self::$instances[$instance_name])) {
|
||||
//echo "new FronkDB instance $instance_name\n";
|
||||
$c = __CLASS__;
|
||||
self::$instances[$instance_name] = new $c($host,$user,$pass,$db);
|
||||
}
|
||||
} else {
|
||||
//echo "existing FronkDB instance $instance_name\n";
|
||||
}
|
||||
return self::$instances[$instance_name];
|
||||
}
|
||||
|
||||
private function connect() {
|
||||
//echo "FronkDB connection to ".$this->host." (".$this->user.", ".$this->db.")\n";
|
||||
if(!$this->link) {
|
||||
$this->link=mysqli_connect($this->host,$this->user,$this->pass,$this->db) or die("Error connecting to database...".mysqli_error($this->link));
|
||||
}
|
||||
|
||||
@@ -347,16 +347,15 @@ class mfBaseApicontroller {
|
||||
$this->mfDBI=FronkDB::singleton();
|
||||
|
||||
}
|
||||
return $this->mfDBI;
|
||||
} else {
|
||||
// else return a new instance
|
||||
var_dump($args);
|
||||
$dbhost=$args[0];
|
||||
$dbuser=$args[1];
|
||||
$dbpass=$args[2];
|
||||
$dbname=$args[3];
|
||||
return $this->getNewDBInstance($dbhost,$dbuser,$dbpass,$dbname);
|
||||
$this->mfDBI = $this->getNewDBInstance($dbhost,$dbuser,$dbpass,$dbname);
|
||||
}
|
||||
return $this->mfDBI;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user