本文整理汇总了PHP中Zend\Db\Adapter\ParameterContainer::offsetHasErrata方法的典型用法代码示例。如果您正苦于以下问题:PHP ParameterContainer::offsetHasErrata方法的具体用法?PHP ParameterContainer::offsetHasErrata怎么用?PHP ParameterContainer::offsetHasErrata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Db\Adapter\ParameterContainer
的用法示例。
在下文中一共展示了ParameterContainer::offsetHasErrata方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bindParametersFromContainer
/**
* Bind parameters from container
*/
protected function bindParametersFromContainer()
{
if ($this->parametersBound) {
return;
}
$parameters = $this->parameterContainer->getNamedArray();
foreach ($parameters as $name => &$value) {
if (is_bool($value)) {
$type = \PDO::PARAM_BOOL;
} else {
$type = \PDO::PARAM_STR;
}
if ($this->parameterContainer->offsetHasErrata($name)) {
switch ($this->parameterContainer->offsetGetErrata($name)) {
case ParameterContainer::TYPE_INTEGER:
$type = \PDO::PARAM_INT;
break;
case ParameterContainer::TYPE_NULL:
$type = \PDO::PARAM_NULL;
break;
case ParameterContainer::TYPE_LOB:
$type = \PDO::PARAM_LOB;
break;
}
}
// parameter is named or positional, value is reference
$parameter = is_int($name) ? $name + 1 : $name;
$this->resource->bindParam($parameter, $value, $type);
}
}
示例2: bindParametersFromContainer
/**
* Bind parameters from container
*
* @return void
*/
protected function bindParametersFromContainer()
{
$parameters = $this->parameterContainer->getNamedArray();
$type = '';
$args = array();
foreach ($parameters as $name => &$value) {
if ($this->parameterContainer->offsetHasErrata($name)) {
switch ($this->parameterContainer->offsetGetErrata($name)) {
case ParameterContainer::TYPE_DOUBLE:
$type .= 'd';
break;
case ParameterContainer::TYPE_NULL:
$value = null;
// as per @see http://www.php.net/manual/en/mysqli-stmt.bind-param.php#96148
// as per @see http://www.php.net/manual/en/mysqli-stmt.bind-param.php#96148
case ParameterContainer::TYPE_INTEGER:
$type .= 'i';
break;
case ParameterContainer::TYPE_STRING:
default:
$type .= 's';
break;
}
} else {
$type .= 's';
}
$args[] =& $value;
}
if ($args) {
array_unshift($args, $type);
call_user_func_array(array($this->resource, 'bind_param'), $args);
}
}
示例3: bindParametersFromContainer
/**
* Bind parameters from container
*
* @param ParameterContainer $pContainer
*/
protected function bindParametersFromContainer()
{
$parameters = $this->parameterContainer->getNamedArray();
foreach ($parameters as $name => &$value) {
if ($this->parameterContainer->offsetHasErrata($name)) {
switch ($this->parameterContainer->offsetGetErrata($name)) {
case ParameterContainer::TYPE_NULL:
$type = null;
$value = null;
break;
case ParameterContainer::TYPE_DOUBLE:
case ParameterContainer::TYPE_INTEGER:
$type = SQLT_INT;
if (is_string($value)) {
$value = (int) $value;
}
break;
case ParameterContainer::TYPE_BINARY:
$type = SQLT_BIN;
break;
case ParameterContainer::TYPE_STRING:
default:
$type = SQLT_CHR;
break;
}
} else {
$type = SQLT_CHR;
}
oci_bind_by_name($this->resource, $name, $value, -1, $type);
}
}
示例4: bindParametersFromContainer
/**
* Bind parameters from container
*
* @param ParameterContainer $pContainer
*/
protected function bindParametersFromContainer()
{
$parameters = $this->parameterContainer->getNamedArray();
foreach ($parameters as $name => &$value) {
if ($this->parameterContainer->offsetHasErrata($name)) {
switch ($this->parameterContainer->offsetGetErrata($name)) {
case ParameterContainer::TYPE_NULL:
$type = null;
$value = null;
break;
case ParameterContainer::TYPE_DOUBLE:
case ParameterContainer::TYPE_INTEGER:
$type = SQLT_INT;
if (is_string($value)) {
$value = (int) $value;
}
break;
case ParameterContainer::TYPE_BINARY:
$type = SQLT_BIN;
break;
case ParameterContainer::TYPE_LOB:
$type = OCI_B_CLOB;
$clob = oci_new_descriptor($this->driver->getConnection()->getResource(), OCI_DTYPE_LOB);
$clob->writetemporary($value, OCI_TEMP_CLOB);
$value = $clob;
break;
case ParameterContainer::TYPE_STRING:
default:
$type = SQLT_CHR;
break;
}
} else {
$type = SQLT_CHR;
}
$maxLength = -1;
if ($this->parameterContainer->offsetHasMaxLength($name)) {
$maxLength = $this->parameterContainer->offsetGetMaxLength($name);
}
oci_bind_by_name($this->resource, $name, $value, $maxLength, $type);
}
}
示例5: bindParametersFromContainer
/**
* Bind parameters from container
*
* @param ParameterContainer $container
*/
protected function bindParametersFromContainer(ParameterContainer $container)
{
$parameters = $container->getNamedArray();
foreach ($parameters as $position => &$value) {
$type = \PDO::PARAM_STR;
if ($container->offsetHasErrata($position)) {
switch ($container->offsetGetErrata($position)) {
case ParameterContainer::TYPE_INTEGER:
$type = \PDO::PARAM_INT;
break;
case ParameterContainer::TYPE_NULL:
$type = \PDO::PARAM_NULL;
break;
case ParameterContainer::TYPE_LOB:
$type = \PDO::PARAM_LOB;
break;
case is_bool($value):
$type = \PDO::PARAM_BOOL;
break;
}
}
// parameter is named or positional, value is reference
$parameter = is_int($position) ? $position + 1 : $position;
$this->resource->bindParam($parameter, $value, $type);
}
}
示例6: testOffsetHasErrata
/**
* @testdox unit test: Test offsetHasErrata() will check if errata exists for a particular key
* @covers Zend\Db\Adapter\ParameterContainer::offsetHasErrata
*/
public function testOffsetHasErrata()
{
$this->parameterContainer->offsetSetErrata('foo', ParameterContainer::TYPE_INTEGER);
$this->assertTrue($this->parameterContainer->offsetHasErrata('foo'));
}