/** * Normalize values to a scheme expected by insert() and update(). */ protected function typeJuggle($col, $val) { // promote actual PHP nulls to SQL nulls if (is_null($val)) { $val = new DB\Null(); } if ($val instanceof DB\Literal) { return $val; } // if we just have a PHP native type here, we may need to do // some juggling: switch ($this->typeOf($col)) { case 'bool': if ($val) { $val = DB::True(); } else { $val = DB::False(); } break; case 'int': break; } return $val; }