public static function getConnection() { if (!isset(self::$instance)) { self::$instance = new Mysql(false); } return self::$instance; }
public static function getInstance() { if (self::$instance == null) { self::$instance = new Mysql(); } return self::$instance; }
public static function getInstance($dbHost) { if (!Mysql::$instance) { Mysql::$instance = new Mysql($dbHost); } return Mysql::$instance; }
static function getInstance($dbHost, $dbName, $dbUser, $dbPass) { if(!Mysql::$instance) { Mysql::$instance = new Mysql($dbHost, $dbName, $dbUser, $dbPass); } return Mysql::$instance; }
/** * Return a singleton instance * * @param null $config * * @return Mysql Singleton Reference * @throws MySQLException * @throws \Exception */ public static function get_instance($config = null) { try { if (is_null(self::$instance)) { self::$instance = new Mysql($config); } } catch (MySQLException $e) { throw $e; } return self::$instance; }
public function disconnect() { if ($this->_mysql_link) { mysql_close($this->_mysql_link); $this->_mysql_link = null; } self::$instance = null; }
public static function getInstance($id) { if (!$id) { foreach (Model::getConnectionsData() as $k => $v) { if ($v['type_db'] == "mysql") { $id = $k; break; } } } Debug::log("getInstance Mysql.", __LINE__, __FUNCTION__, __CLASS__, __FILE__); if (!isset(self::$instance) || !is_object(self::$instance)) { $class = __CLASS__; self::$instance = new $class($id); } if (!isset(self::$connection[$id])) { self::$instance->newConnection($id); } return self::$instance; }
/** static public function get_instance * Returns the singleton instance * of the MySQL Object as a reference * * @param array optional configuration array * @action optionally creates the instance * @return MySQL Object reference */ public static function get_instance($config = null) { try { if (is_null(self::$instance)) { self::$instance = new Mysql($config); } self::$instance->test_connection(); self::$instance->_log(__METHOD__ . ' --------------------------------------'); } catch (MySQLException $e) { throw $e; } return self::$instance; }