本文整理汇总了PHP中QType::Constant方法的典型用法代码示例。如果您正苦于以下问题:PHP QType::Constant方法的具体用法?PHP QType::Constant怎么用?PHP QType::Constant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QType
的用法示例。
在下文中一共展示了QType::Constant方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AnalyzeTableColumn
protected function AnalyzeTableColumn(QDatabaseFieldBase $objField, $objTable)
{
$objColumn = new QColumn();
$objColumn->Name = $objField->Name;
$objColumn->OwnerTable = $objTable;
if (substr_count($objField->Name, "-")) {
$tableName = $objTable ? " in table " . $objTable->Name : "";
$this->strErrors .= "Invalid column name" . $tableName . ": " . $objField->Name . ". Dashes are not allowed.";
return null;
}
$objColumn->DbType = $objField->Type;
$objColumn->VariableType = $this->VariableTypeFromDbType($objColumn->DbType);
$objColumn->VariableTypeAsConstant = QType::Constant($objColumn->VariableType);
$objColumn->Length = $objField->MaxLength;
$objColumn->Default = $objField->Default;
$objColumn->PrimaryKey = $objField->PrimaryKey;
$objColumn->NotNull = $objField->NotNull;
$objColumn->Identity = $objField->Identity;
$objColumn->Unique = $objField->Unique;
if ($objField->PrimaryKey && $objTable && count($objTable->PrimaryKeyColumnArray) == 1) {
$objColumn->Unique = true;
}
$objColumn->Timestamp = $objField->Timestamp;
$objColumn->VariableName = $this->VariableNameFromColumn($objColumn);
$objColumn->PropertyName = $this->PropertyNameFromColumn($objColumn);
$objColumn->Comment = $objField->Comment;
return $objColumn;
}
示例2: AnalyzeTableColumn
protected function AnalyzeTableColumn(QDatabaseFieldBase $objField, $objTable)
{
$objColumn = new QColumn();
$objColumn->Name = $objField->Name;
$objColumn->DbType = $objField->Type;
$objColumn->VariableType = $this->VariableTypeFromDbType($objColumn->DbType);
$objColumn->VariableTypeAsConstant = QType::Constant($objColumn->VariableType);
$objColumn->Length = $objField->MaxLength;
$objColumn->Default = $objField->Default;
$objColumn->PrimaryKey = $objField->PrimaryKey;
$objColumn->NotNull = $objField->NotNull;
$objColumn->Identity = $objField->Identity;
$objColumn->Unique = $objField->Unique;
if ($objField->PrimaryKey && $objTable && count($objTable->PrimaryKeyColumnArray) == 1) {
$objColumn->Unique = true;
}
$objColumn->Timestamp = $objField->Timestamp;
$objColumn->VariableName = $this->VariableNameFromColumn($objColumn);
$objColumn->PropertyName = $this->PropertyNameFromColumn($objColumn);
return $objColumn;
}
示例3: AnalyzeTableColumn
protected function AnalyzeTableColumn(QDatabaseFieldBase $objField, $objTable)
{
$objColumn = new QSqlColumn();
$objColumn->Name = $objField->Name;
$objColumn->OwnerTable = $objTable;
if (substr_count($objField->Name, "-")) {
$tableName = $objTable ? " in table " . $objTable->Name : "";
$this->strErrors .= "Invalid column name" . $tableName . ": " . $objField->Name . ". Dashes are not allowed.";
return null;
}
$objColumn->DbType = $objField->Type;
$objColumn->VariableType = $this->VariableTypeFromDbType($objColumn->DbType);
$objColumn->VariableTypeAsConstant = QType::Constant($objColumn->VariableType);
$objColumn->Length = $objField->MaxLength;
$objColumn->Default = $objField->Default;
$objColumn->PrimaryKey = $objField->PrimaryKey;
$objColumn->NotNull = $objField->NotNull;
$objColumn->Identity = $objField->Identity;
$objColumn->Unique = $objField->Unique;
if ($objField->PrimaryKey && $objTable && count($objTable->PrimaryKeyColumnArray) == 1) {
$objColumn->Unique = true;
}
$objColumn->Timestamp = $objField->Timestamp;
$objColumn->VariableName = $this->ModelColumnVariableName($objColumn);
$objColumn->PropertyName = $this->ModelColumnPropertyName($objColumn->Name);
// separate overrides embedded in the comment
// extract options embedded in the comment field
if (($strComment = $objField->Comment) && ($pos1 = strpos($strComment, '{')) !== false && ($pos2 = strrpos($strComment, '}', $pos1))) {
$strJson = substr($strComment, $pos1, $pos2 - $pos1 + 1);
$a = json_decode($strJson, true);
if ($a) {
$objColumn->Options = $a;
$objColumn->Comment = substr($strComment, 0, $pos1) . substr($strComment, $pos2 + 1);
// return comment without options
if (!empty($a['Timestamp'])) {
$objColumn->Timestamp = true;
// alternate way to specify that a column is a self-updating timestamp
}
if ($objColumn->Timestamp && !empty($a['AutoUpdate'])) {
$objColumn->AutoUpdate = true;
}
} else {
$objColumn->Comment = $strComment;
}
}
// merge with options found in the design editor, letting editor take precedence
$objColumn->Options = $this->objModelConnectorOptions->GetOptions($objTable->ClassName, $objColumn->PropertyName) + $objColumn->Options;
return $objColumn;
}