本文整理匯總了PHP中Zend\Db\Adapter\ParameterContainer::offsetHasMaxLength方法的典型用法代碼示例。如果您正苦於以下問題:PHP ParameterContainer::offsetHasMaxLength方法的具體用法?PHP ParameterContainer::offsetHasMaxLength怎麽用?PHP ParameterContainer::offsetHasMaxLength使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Db\Adapter\ParameterContainer
的用法示例。
在下文中一共展示了ParameterContainer::offsetHasMaxLength方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
}