/**
  * Add meta data belonging to given object
  * @param \Rocker\Object\MetaInterface $obj
  */
 function applyMetaData(MetaInterface $obj)
 {
     $meta_values = $this->cache->fetch($this->cachePrefix . $obj->getId());
     if (!is_array($meta_values)) {
         $meta_values = array();
         $sql = $this->db->prepare("SELECT name, value FROM " . $this->dbTable . " WHERE object=?");
         $sql->execute(array($obj->getId()));
         while ($row = $sql->fetch()) {
             if (is_numeric($row['value'])) {
                 $int = intval($row['value']);
                 if (strlen((string) $int) === strlen($row['value'])) {
                     $meta_values[$row['name']] = $int;
                 } elseif (is_float($float = (double) $row['value'])) {
                     $meta_values[$row['name']] = $float;
                 } else {
                     $meta_values[$row['name']] = $row['value'];
                 }
             } elseif ($this->isSerialized($row['value'])) {
                 $meta_values[$row['name']] = unserialize($row['value']);
             } else {
                 $meta_values[$row['name']] = $row['value'];
             }
         }
         $this->cache->store($this->cachePrefix . $obj->getId(), $meta_values);
     }
     $obj->setMeta(new MetaData($meta_values));
 }
 /**
  * @inheritdoc
  */
 public function isInstalled()
 {
     $installed = false;
     try {
         $this->db->query('SELECT COUNT(*) FROM ' . $this->tableName);
         $installed = true;
     } catch (\Exception $e) {
         if ($e->getCode() != '42S02') {
             throw $e;
         }
     }
     return $installed;
 }
 public function testConnect()
 {
     self::$db->query('SHOW TABLES')->execute();
 }