Пример #1
0
 /**
  * Bind parameters from container
  * 
  * @param ParameterContainerInterface $container 
  */
 protected function bindParametersFromContainer(ParameterContainerInterface $container)
 {
     $parameters = $container->toArray();
     foreach ($parameters as $position => &$value) {
         $type = \PDO::PARAM_STR;
         if ($container->offsetHasErrata($position)) {
             switch ($container->offsetGetErrata($position)) {
                 case ParameterContainerInterface::TYPE_INTEGER:
                     $type = \PDO::PARAM_INT;
                     break;
                 case ParameterContainerInterface::TYPE_NULL:
                     $type = \PDO::PARAM_NULL;
                     break;
                 case ParameterContainerInterface::TYPE_LOB:
                     $type = \PDO::PARAM_LOB;
                     break;
                 case is_bool($value):
                     $type = \PDO::PARAM_BOOL;
                     break;
             }
         }
         // position is named or positional, value is reference
         $this->resource->bindParam(is_int($position) ? $position + 1 : $position, $value, $type);
     }
 }