Beispiel #1
0
 protected function parseField($k, $v)
 {
     if ($k == "created") {
         return $v != "" ? new DateTime($v) : null;
     } else {
         return parent::parseField($k, $v);
     }
 }
Beispiel #2
0
 public function __construct($host, $user, $pass, $name)
 {
     $sql = new mysqli($host, $user, $pass, $name);
     if ($sql->connect_errno) {
         throw new Exception("failed to connect to mysql: " . $sql->connect_error);
     }
     $sql->set_charset("utf8");
     parent::__construct($sql);
 }