WebFioriAPI ReferenceLearnDownloadContributeLearn{{result.parent_page}} > {{result.title}}{{result.title}}Classes{{result.class_name}}{{result.summary}}Methods{{result.name}}{{result.summary}}

namespace \webfiori\database

abstract class Column

Class Methods Summary

public function __construct(string$name)Creates new instance of the class.public abstract function asString()Returns a string that represents the column.public abstract function cleanValue(unkown_type$val)Filters and cleans column value before using it in a query.public function getAlias()Returns column alias.public function getComment()Returns a string that represents a comment which was added with the column.public function getCustomCleaner()Returns the function which is used to filter the value of the column.public function getDatatype()Returns the type of column data (such as 'varchar').public function getDefault()Returns the default value of the column.public function getIndex()Returns the index of the column in its parent table.public function getName()Returns the name of the column.public function getOldName()Returns the old name of the column.public function getOwner()Returns the table who owns the column.public function getPHPType()Returns a string that represents the datatype as one of PHP datatypes.public function getPrevOwner()Returns the previous table which was owns the column.public function getScale()Returns the value of scale.public function getSize()Returns the size of the column.public function getSupportedTypes()Returns an array that contains supported datatypes.public function isNameWithTablePrefix()Checks if table name will be prefixed with database name or not.public function isNull()Checks if the column allows null values.public function isPrimary()Checks if the column is part of the primary key or not.public function isUnique()Returns the value of the property $isUnique.public function setAlias(string$alias)Sets an alias for the column.public function setComment(string|null$comment)Sets a comment which will appear with the column.public function setCustomFilter(Closure$callback)Sets a custom filtering function to cleanup values before being used in database queries.public function setDatatype(string$type)Sets the type of column data.public function setDefault(mixed$defaultVal)Sets the default value for the column to use in case of insert.public function setIsNull(boolean$bool)Updates the value of the property $isNull.public function setIsPrimary(boolean$bool)Updates the value of the property $isPrimary.public function setIsUnique(boolean$bool)Sets the value of the property $isUnique.public function setName(string$name)Sets the name of the column.public function setOwner(Table|null$table)Sets or unset the owner table of the column.public function setScale(unkown_type$scale)Sets the value of Scale.public function setSize(int$size)Sets the size of the data that will be stored by the column.public function setSupportedTypes(array$datatypes)Adds a set of values as a supported datatypes for the column.public function setWithTablePrefix(boolean$withDbPrefix)Sets the value of the attributes which determine if table name will be prefixed with database name or not.

Class Methods Details

public function __construct(string$name)Creates new instance of the class.

Parameters:

  • string $name The name of the column as it appears in the database.
public abstract function asString()Returns a string that represents the column. The developer should implement this method in a way that it returns a string that can be used to add the column to a new table or to alter a column in an existing table.Returns: stringA string that represents the column.public abstract function cleanValue(unkown_type$val)Filters and cleans column value before using it in a query.

Parameters:

  • unkown_type $val
Returns: mixedThe value after cleanup.
public function getAlias()Returns column alias. Returns: string|nullName alias.public function getComment()Returns a string that represents a comment which was added with the column. Returns: string|nullComment text. If it is not set, the method will return null.public function getCustomCleaner()Returns the function which is used to filter the value of the column. Returns: ClosureThe function which is used to filter the value of the column.public function getDatatype()Returns the type of column data (such as 'varchar'). Returns: stringThe type of column data. Default return value is 'char'.public function getDefault()Returns the default value of the column. Returns: mixedThe default value of the column.public function getIndex()Returns the index of the column in its parent table. Returns: intThe index of the column in its parent table starting from 0. If the column has no parent table, the method will return -1.public function getName()Returns the name of the column. Returns: stringThe name of the column.public function getOldName()Returns the old name of the column. Note that the old name will be set only if the method Column::setName() is called more than once in the same instance. If no old name is set, the method will return current name.Returns: string|nullThe method will return a string that represents the old name if it is set. Null if not.public function getOwner()Returns the table who owns the column. Returns: Table|nullIf the owner is set, the method will return an object of type 'Table' that represent it. Other than that, the method will return null.public function getPHPType()Returns a string that represents the datatype as one of PHP datatypes. The main aim of this method is to produce correct type hinting when mapping the column to an entity class. For example, the 'varchar' in MySQL is a 'string' in PHP.Returns: stringA string that represents column datatype in PHP.public function getPrevOwner()Returns the previous table which was owns the column. Returns: Table|nullIf the owner of the table was set then updated, the method will return the old owner value.public function getScale()Returns the value of scale. Scale is simply the number of digits that will appear to the right of decimal point. Only applicable if the datatype of the column is decimal, float or double.Returns: intThe number of numbers after the decimal point.public function getSize()Returns the size of the column. Returns: intThe size of the column.public function getSupportedTypes()Returns an array that contains supported datatypes. Returns: arrayAn array that contains supported datatypes.public function isNameWithTablePrefix()Checks if table name will be prefixed with database name or not. Returns: booleanTrue if it will be prefixed. False if not.public function isNull()Checks if the column allows null values. Returns: booleantrue if the column allows null values. Default return value is false which means that the column does not allow null values.public function isPrimary()Checks if the column is part of the primary key or not. Returns: booleantrue if the column is primary. Default return value is false.public function isUnique()Returns the value of the property $isUnique. Returns: booleantrue if the column value is unique.public function setAlias(string$alias)Sets an alias for the column.

Parameters:

public function setComment(string|null$comment)Sets a comment which will appear with the column.

Parameters:

  • string|null $comment Comment text. It must be non-empty string in order to set. If null is passed, the comment will be removed.
public function setCustomFilter(Closure$callback)
Sets a custom filtering function to cleanup values before being used in database queries. The function signature should be as follows : function ($orgVal, $cleanedVa) where the first value is the original value and the second one is the value with basic filtering applied to.

Parameters:

  • Closure $callback The callback.
Returns: booleanIf it was updated, the method will return true. Other than that, the method will return false.
public function setDatatype(string$type)Sets the type of column data. Note that calling this method will set default value to null.

Parameters:

  • string $type The type of column data.
public function setDefault(mixed$defaultVal)Sets the default value for the column to use in case of insert.

Parameters:

  • mixed $defaultVal The default value.
public function setIsNull(boolean$bool)Updates the value of the property $isNull. This property can be set to true if the column allow the insertion of null values. Note that for primary key column, the method will have no effect.

Parameters:

  • boolean $bool true if the column allow null values. false if not.
Returns: booleantrue If the property value is updated. If the given value is not a boolean, the method will return false. Also if the column represents a primary key, the method will always return false.
public function setIsPrimary(boolean$bool)
Updates the value of the property $isPrimary. Note that once the column become primary, it will not allow null values.

Parameters:

  • boolean $bool true if the column is primary key. false if not.
public function setIsUnique(boolean$bool)Sets the value of the property $isUnique.

Parameters:

  • boolean $bool True if the column value is unique. false if not.
public function setName(string$name)Sets the name of the column.

Parameters:

  • string $name The name of the column as it appears in the database.
public function setOwner(Table|null$table)Sets or unset the owner table of the column. Note that the developer should not call this method manually. It is used only if the column is added or removed from Table object.

Parameters:

  • Table|null $table The owner of the column. If null is given, The owner will be unset.
public function setScale(unkown_type$scale)Sets the value of Scale. Scale is simply the number of digits that will appear to the right of decimal point. Only applicable if the datatype of the column is decimal, float and double.

Parameters:

  • unkown_type $scale
public function setSize(int$size)Sets the size of the data that will be stored by the column.

Parameters:

  • int $size A positive number that represents the size. must be greater than 0.
Returns: booleanIf the size is set, the method will return true. Other than that, it will return false.
public function setSupportedTypes(array$datatypes)Adds a set of values as a supported datatypes for the column.

Parameters:

  • array $datatypes An indexed array that contains a strings that represents the types.
public function setWithTablePrefix(boolean$withDbPrefix)Sets the value of the attributes which determine if table name will be prefixed with database name or not. Note that table name will be prefixed with database name only if owner schema is set.

Parameters:

  • boolean $withDbPrefix True to prefix table name with database name. false to not prefix table name with database name.
mdi-menuAll Classesmdi-chevron-leftAnchorBrCodeSnippetHTMLDocHTMLListHTMLNodeHTMLTableHeadNodeInputJsCodeLabelListItemOrderedListParagraphRadioGroupTableCellTableRowUnorderedListInvalidNodeNameExceptionTemplateNotFoundExceptionCaseConverterJsonJsonConverterJsonIJsonTypesPropertyAPIFilterAbstractWebServiceManagerInfoServiceParamTypesRequestRequestParameterResponseUriWebServicesManagerAccessAutoLoaderConfigConfigControllerDBEAbstractWebServiceExtendedWebServicesManagerFileLoggerPrivilegePrivilegesGroupThemeThemeLoaderUploadFileUploaderUserUtilWebFioriAppLanguageErrorBoxHTTPCodeViewMessageBoxServerErrViewStarterPageWebPageDatabaseSessionStorageDefaultSessionStorageMSSQLSessionDataTableMSSQLSessionsTableMySQLSessionDataTableMySQLSessionsTableSessionSessionOperationsSessionStorageSessionsManagerRouterRouterUriAbstractMiddlewareMiddlewareManagerEmailMessageSMTPAccountSMTPServerClassLoaderExceptionFileExceptionInitializationExceptionInvalidCRONExprExceptionMissingLangExceptionNoSuchThemeExceptionRoutingExceptionSMTPExceptionSessionExceptionUIExceptionAbstractJobCronCronEmailCronJobJobArgumentCronLoginViewCronTasksViewCronViewCronLoginServiceCronLogoutServiceCronServicesManagerForceCronExecutionServiceGetJobsServiceCLICLICommandInputStreamOutputStreamStdInStdOutClassWriterLangClassWriterQueryClassWriterServiceHolderThemeClassWriterWebServiceWriterCreateCLIClassHelperCreateCronJobCreateMiddlewareCreateTableCreateTableObjCreateThemeHelperCreateWebServiceAddCommandCreateCommandCronCommandHelpCommandListCronCommandListRoutesCommandListThemesCommandRunSQLQueryCommandSettingsCommandTestRouteCommandUpdateSettingsCommandUpdateTableCommandVersionCommandAbstractQueryColumnColumnFactoryConditionConnectionConnectionInfoDatabaseDatabaseExceptionDateTimeValidatorEntityMapperExpressionForeignKeyJoinTableResultSetSelectExpressionTableWhereExpressionMySQLColumnMySQLConnectionMySQLQueryMySQLTableMSSQLColumnMSSQLConnectionMSSQLQueryMSSQLTableAbstractCollectionComparableLinkedListNodeQueueStack
Powered By: WebFiori Framework, Vue and VuetifyAll Rights Reserved © 2018 - 2024