Esempio n. 1
0
 function init()
 {
     $dsn = \woo\base\ApplicationRegistry::getDSN();
     if (!is_null($dsn)) {
         return;
     }
     $this->getOptions();
 }
Esempio n. 2
0
 function init()
 {
     $dsn = ApplicationRegistry::getDSN();
     if (!is_null($dsn)) {
         // Данные хранятся в кэше
         return;
     }
     $this->getOptions();
 }
Esempio n. 3
0
 function __construct()
 {
     $dsn = ApplicationRegistry::getDSN();
     if (is_null($dsn)) {
         throw new AppException('DSN не задан');
     }
     self::$DB = new \PDO($dsn);
     self::$DB->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
 }
Esempio n. 4
0
 function __construct()
 {
     if (!isset(self::$PDO)) {
         $dsn = \woo\base\ApplicationRegistry::getDSN();
         if (is_null($dsn)) {
             throw new \woo\base\AppException("No DSN");
         }
         self::$PDO = new \PDO($dsn);
         self::$PDO->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
     }
 }
Esempio n. 5
0
 function __construct()
 {
     if (!isset(self::$PDO)) {
         $dsn = ApplicationRegistry::getDSN();
         if (is_null($dsn)) {
             throw new AppException('DSN не определен');
         }
         self::$PDO = new \PDO($dsn);
         self::$PDO->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
     }
 }
Esempio n. 6
0
<?php

require_once "listing12.05.php";
// Registry
// test file app registry
if (!isset($argv[1])) {
    // run script without argument to monitor
    while (1) {
        sleep(5);
        $thing = \woo\base\ApplicationRegistry::getDSN();
        \woo\base\RequestRegistry::instance();
        \woo\base\SessionRegistry::instance();
        \woo\base\MemApplicationRegistry::instance();
        print "dsn is {$thing}\n";
    }
} else {
    // run script with argument in separate window to change value.. see the result in monitor process
    print "setting dsn {$argv[1]}\n";
    \woo\base\ApplicationRegistry::setDSN($argv[1]);
}