示例#1
0
 public function __construct(\Gaia\DB\Iface $db, $table, $user_id)
 {
     if (!$db->isa('sqlite')) {
         throw new Exception('invalid driver', $db);
     }
     if (!$db->isa('gaia\\db\\extendediface')) {
         throw new Exception('invalid driver', $db);
     }
     $this->db = $db;
     $this->table = $table;
     $this->user_id = $user_id;
 }
示例#2
0
 public function __construct(\Gaia\DB\Iface $db, $app = 'default')
 {
     if (!preg_match('/^[a-z0-9_]+$/', $app)) {
         throw new Exception('invalid-app');
     }
     if (!$db->isa('mysql')) {
         trigger_error('invalid db layer', E_USER_ERROR);
         exit(1);
     }
     if (!$db->isa('\\gaia\\db\\extendediface')) {
         $db = new \Gaia\DB($db);
     }
     if (!$db->isa('gaia\\db\\except')) {
         $db = new \Gaia\DB\Except($db);
     }
     $this->app = $app;
     $this->db = $db;
 }