本文整理匯總了PHP中xmldb_field::getNotNull方法的典型用法代碼示例。如果您正苦於以下問題:PHP xmldb_field::getNotNull方法的具體用法?PHP xmldb_field::getNotNull怎麽用?PHP xmldb_field::getNotNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xmldb_field
的用法示例。
在下文中一共展示了xmldb_field::getNotNull方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getDefaultValue
/**
* Give one xmldb_field, returns the correct "default value" for the current configuration
*
* @param xmldb_field $xmldb_field The field.
* @return The default value of the field.
*/
public function getDefaultValue($xmldb_field)
{
$default = null;
if ($xmldb_field->getDefault() !== NULL) {
if ($xmldb_field->getType() == XMLDB_TYPE_CHAR || $xmldb_field->getType() == XMLDB_TYPE_TEXT) {
if ($xmldb_field->getDefault() === '') {
// If passing empty default, use the $default_for_char one instead
$default = "'" . $this->default_for_char . "'";
} else {
$default = "'" . $this->addslashes($xmldb_field->getDefault()) . "'";
}
} else {
$default = $xmldb_field->getDefault();
}
} else {
/// We force default '' for not null char columns without proper default
/// some day this should be out!
if ($this->default_for_char !== NULL && $xmldb_field->getType() == XMLDB_TYPE_CHAR && $xmldb_field->getNotNull()) {
$default = "'" . $this->default_for_char . "'";
} else {
/// If the DB requires to explicity define some clause to drop one default, do it here
/// never applying defaults to TEXT and BINARY fields
if ($this->drop_default_value_required && $xmldb_field->getType() != XMLDB_TYPE_TEXT && $xmldb_field->getType() != XMLDB_TYPE_BINARY && !$xmldb_field->getNotNull()) {
$default = $this->drop_default_value;
}
}
}
return $default;
}