예제 #1
0
파일: Tab.php 프로젝트: schpill/standalone
 public function __construct(Db $db, $closure = null)
 {
     $this->collection = 'collection.results.redis.' . $db->db . '.' . $db->table;
     $results = new Results($db);
     Now::set($this->collection, $results);
     $this->closure = $closure;
 }
예제 #2
0
 public function __construct($db, $table)
 {
     $config = Config::get('mdo.config.' . $db, []);
     if (empty($config)) {
         $config = ['driver' => Config::get('database.adapter', 'mysql'), 'host' => Config::get('database.host', '127.0.0.1'), 'database' => Config::get('database.dbname', SITE_NAME), 'username' => Config::get('database.username', 'root'), 'password' => Config::get('database.password', 'root'), 'charset' => Config::get('database.charset', 'utf8'), 'collation' => Config::get('database.collation', 'utf8_unicode_ci'), 'prefix' => Config::get('database.prefix', '')];
     }
     if (empty($config)) {
         throw new Exception('No config provided to launch motor.');
     }
     $link = mysqli_connect($config['host'], $config['username'], $config['password'], $config['database']);
     Now::set("link.{$db}.{$table}", $link);
     $this->table = $table;
     $this->database = $db;
 }
예제 #3
0
파일: Db.php 프로젝트: schpill/standalone
 /**
  * [reset description]
  *
  * @method reset
  *
  * @return [type] [description]
  */
 public function reset()
 {
     $this->results = null;
     $this->totalResults = 0;
     $this->transactions = 0;
     $this->selects = [];
     $this->joinTables = [];
     $this->wheres = [];
     $this->groupBys = [];
     $this->orders = [];
     $store = new Store($this->collection);
     $this->events = new Event($this->collection);
     Now::set('Nosql.store.' . $this->collection, $store);
     return $this;
 }
예제 #4
0
파일: Db.php 프로젝트: schpill/standalone
 public function reset()
 {
     $this->results = null;
     $this->totalResults = 0;
     $this->transactions = 0;
     $this->selects = [];
     $this->joinTables = [];
     $this->wheres = [];
     $this->groupBys = [];
     $this->orders = [];
     $store = lib('redys', ['Blazz.' . $this->collection]);
     $this->events = new Event($this->collection);
     Now::set('blazz.store.' . $this->collection, $store);
     return $this;
 }
예제 #5
0
 public function __construct($db, $table)
 {
     $file = Config::get('mlite.dir.' . $db, STORAGE_PATH . DS . $db . '.db');
     $new = !is_file($file);
     if (!is_file($file)) {
         File::create($file);
     }
     $link = new SQLite3($file);
     Now::set("lite.link.{$db}.{$table}", $link);
     if ($new) {
         $q = "CREATE TABLE IF NOT EXISTS infosdb (data_key VARCHAR PRIMARY KEY, data_value);";
         $res = $link->exec($q);
     }
     $this->table = $table;
     $this->database = $db;
 }
예제 #6
0
 public function __set($k, $v)
 {
     if ($k == 'cursor') {
         $nowKey = 'cursor.' . $this->database . '.' . $this->table;
         Now::set($nowKey, $v);
     } else {
         $this->{$k} = $v;
     }
     return $this;
 }