예제 #1
0
파일: ama.inc.php 프로젝트: eguicciardi/ada
 /**
  * Returns an instance of AMA_DataHandler.
  *
  * @param  string $dsn - optional, a valid data source name
  * @return an instance of AMA_DataHandler
  */
 static function instance($dsn = null)
 {
     $callerClassName = get_called_class();
     if (get_class(self::$instance) !== $callerClassName) {
         self::$instance = null;
     }
     if (self::$instance === NULL) {
         self::$instance = new $callerClassName($dsn);
     } else {
         self::$instance->setDSN($dsn);
     }
     //return null;
     return self::$instance;
 }
예제 #2
0
 public function disconnect()
 {
     parent::disconnect();
     self::$instance = NULL;
 }