Esempio n. 1
0
 /**
  * 
  * @param array $values
  * @param array $columns
  * @return array
  */
 public static function strictTypeValues(array $values, array $columns)
 {
     $strictTypeValues = [];
     foreach ($columns as $index => $column) {
         $key = array_key_exists($column['name'], $values) ? $column['name'] : $index;
         if (!isset($values[$key])) {
             $strictTypeValues[$key] = null;
         } elseif ($values[$key] instanceof Type\Base) {
             $strictTypeValues[$key] = $values[$key];
         } else {
             $strictTypeValues[$key] = Type\Base::getTypeObject($column['type'], $values[$key]);
         }
     }
     return $strictTypeValues;
 }
Esempio n. 2
0
 /**
  * 删除一整行
  * @return \Cassandra\Response\Response
  */
 public function remove()
 {
     $query = Query::delete()->from(static::$_name);
     $conditions = [];
     $bind = [];
     foreach (static::$_primary as $key) {
         $conditions[] = $key . ' = ?';
         $bind[] = Type\Base::getTypeObject(static::$_columns[$key], $this[$key]);
     }
     $query->where(implode(' AND ', $conditions))->bind($bind)->setDbAdapter(static::$_dbAdapter)->setConsistency(static::$_writeConsistency);
     return $query->querySync();
 }