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

namespace \webfiori\database\mssql

class MSSQLTable

Class Methods Summary

public function __construct(string$name)Creates a new instance of the class.public function addColumns(array$colsArr)Adds multiple columns at once.public function getName()Returns the name of the table.public function getUniqueConstraintName()Returns the name of the unique constraint.public function setUniqueConstraintName(string$name)Sets the name of the unique constraint.public function toSQL()Returns SQL query which can be used to create the table.

Class Methods Details

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

Parameters:

  • string $name The name of the table. If empty string is given, the value 'new_table' will be used as default.
public function addColumns(array$colsArr)Adds multiple columns at once.

Parameters:

  • array $colsArr An associative array. The keys will act as column key in the table. The value of the key can be an object of type 'MSSQLColumn' or be an associative array of column options. The available options are:
    • name: The name of the column in the database. If not provided, the name of the key will be used but with every '-' replaced by '_'.
    • datatype: The datatype of the column. If not provided, 'varchar' will be used. Note that the value 'type' can be used as an alias to this index.
    • size: Size of the column (if datatype does support size). If not provided, 1 will be used.
    • default: A default value for the column if its value is not present in case of insert.
    • is-null: A boolean. If the column allows null values, this should be set to true. Default is false.
    • is-primary: A boolean. It must be set to true if the column represents a primary key. Note that the column will be set as unique once its set as a primary.
    • is-unique: A boolean. If set to true, a unique index will be created for the column.
    • auto-update: A boolean. If the column datatype is 'datetime' or similar type and this parameter is set to true, the time of update will change automatically without having to change it manually.
    • scale: Number of numbers to the left of the decimal point. Only supported for decimal datatype.
public function getName()Returns the name of the table. Note that the method will add square brackets around the name.Returns: stringThe name of the table. Default return value is 'new_table'.public function getUniqueConstraintName()Returns the name of the unique constraint. Returns: stringThe name of the unique constraint. If it is not set, the method will return the name of the table prefixed with the string 'AF_' as constraint name.public function setUniqueConstraintName(string$name)Sets the name of the unique constraint.

Parameters:

  • string $name The name of the unique constraint. Must be non-empty string.
public function toSQL()Returns SQL query which can be used to create the table. Returns: stringA string that represents SQL query which can be used to create the table.
mdi-menuAll Classesmdi-chevron-leftAnchorBrCodeSnippetHTMLDocHTMLListHTMLNodeHTMLTableHeadNodeInputJsCodeLabelListItemOrderedListParagraphRadioGroupTableCellTableRowUnorderedListInvalidNodeNameExceptionTemplateNotFoundExceptionCaseConverterJsonJsonConverterJsonIJsonTypesPropertyAPIFilterAbstractWebServiceManagerInfoServiceParamTypesRequestRequestParameterResponseUriWebServicesManagerAccessAutoLoaderConfigConfigControllerDBEAbstractWebServiceExtendedWebServicesManagerFileLoggerPrivilegePrivilegesGroupThemeThemeLoaderUploadFileUploaderUserUtilWebFioriAppLanguageErrorBoxHTTPCodeViewMessageBoxServerErrViewStarterPageWebPageDatabaseSessionStorageDefaultSessionStorageMSSQLSessionDataTableMSSQLSessionsTableMySQLSessionDataTableMySQLSessionsTableSessionSessionOperationsSessionStorageSessionsManagerRouterRouterUriAbstractMiddlewareMiddlewareManagerEmailMessageSMTPAccountSMTPServerClassLoaderExceptionFileExceptionInitializationExceptionInvalidCRONExprExceptionMissingLangExceptionNoSuchThemeExceptionRoutingExceptionSMTPExceptionSessionExceptionUIExceptionAbstractJobCronCronEmailCronJobJobArgumentCronLoginViewCronTasksViewCronViewCronLoginServiceCronLogoutServiceCronServicesManagerForceCronExecutionServiceGetJobsServiceCLICLICommandInputStreamOutputStreamStdInStdOutClassWriterLangClassWriterQueryClassWriterServiceHolderThemeClassWriterWebServiceWriterCreateCLIClassHelperCreateCronJobCreateMiddlewareCreateTableCreateTableObjCreateThemeHelperCreateWebServiceAddCommandCreateCommandCronCommandHelpCommandListCronCommandListRoutesCommandListThemesCommandRunSQLQueryCommandSettingsCommandTestRouteCommandUpdateSettingsCommandUpdateTableCommandVersionCommandAbstractQueryColumnColumnFactoryConditionConnectionConnectionInfoDatabaseDatabaseExceptionDateTimeValidatorEntityMapperExpressionForeignKeyJoinTableResultSetSelectExpressionTableWhereExpressionMySQLColumnMySQLConnectionMySQLQueryMySQLTableMSSQLColumnMSSQLConnectionMSSQLQueryMSSQLTableAbstractCollectionComparableLinkedListNodeQueueStack
Powered By: WebFiori Framework, Vue and VuetifyAll Rights Reserved © 2018 - 2024