v5:dictionary:column_attributes
                Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| v5:dictionary:column_attributes [2016/02/29 00:42] – mnewnham | v5:dictionary:column_attributes [2024/08/31 16:26] (current) – multiple column definitions separated by comma dregad | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ======= Dictionary Column Attributes ======= | ======= Dictionary Column Attributes ======= | ||
| - | <WRAP todo> | ||
| - | Add Argument Definitions | ||
| - | </ | ||
| ====== Description ====== | ====== Description ====== | ||
| - | When creating a column in a table using the dictionary methods, the information provided must confirm | + | When creating a column in a table using the dictionary methods, the information provided must conform | 
| - | -------------------------------- | + | |
| - | <WRAP right info 300px> | + | |
| - | $fields is a string, not an array | + | |
| - | </ | + | |
| ====== Basic Syntax ====== | ====== Basic Syntax ====== | ||
| + | |||
| The basic syntax of the attributes is as follows: | The basic syntax of the attributes is as follows: | ||
| - | * All the information for the column must occur on a single line. | + | * All the information for a given column must occur on a single line. | 
| + | * Multiple columns definitions must be separated by a comma '','' | ||
| * The line ending may be a newline or carriage return/ | * The line ending may be a newline or carriage return/ | ||
| * Each attribute must be separated by at least one tab or space. | * Each attribute must be separated by at least one tab or space. | ||
| Line 44: | Line 40: | ||
| ======= | ======= | ||
| ===== Column Name ===== | ===== Column Name ===== | ||
| - | * The column name must conform to any database specific standards related to naming and length. | + | * The column name must conform to any database specific standards related to naming and length. | 
| - | + | ||
| ===== Meta Attributes ===== | ===== Meta Attributes ===== | ||
| * The column attributes in terms of type and length **must** be specified in terms of ADODb [[v5: | * The column attributes in terms of type and length **must** be specified in terms of ADODb [[v5: | ||
| Line 56: | Line 51: | ||
| </ | </ | ||
| ==== AUTO or AUTOINCREMENT ==== | ==== AUTO or AUTOINCREMENT ==== | ||
| - | Creates the column as auto-increment. Support for this varies from one database to another. Some databases designate a field with an auto-increment flag as the primary key. | + | Creates the column as auto-increment. Support for this varies from one database to another. Some databases designate a field with an auto-increment flag as the primary key, and most databases only allow a single column in a table to be designated as auto-increment. | 
| ----------------------- | ----------------------- | ||
| Line 63: | Line 58: | ||
| </ | </ | ||
| ==== CONSTRAINT ==== | ==== CONSTRAINT ==== | ||
| + | Adds a constraint to column. The syntax for the constraint must be defined as required by the database. | ||
| -------------------------- | -------------------------- | ||
| <WRAP right box 150px> | <WRAP right box 150px> | ||
| Line 69: | Line 64: | ||
| </ | </ | ||
| ==== DEF or DEFAULT ==== | ==== DEF or DEFAULT ==== | ||
| - | ** DEF ** indicates a default value for a column when a row is created. Some databases also require a field with a default value to be designated as NOT NULL, so that is automatically added to the column string | + | ** DEF ** indicates a default value for a column when a row is created. Some databases also require a field with a default value to be designated as NOT NULL, so that is automatically added to the column string. For dynamically created dates or timestsamps, | 
| --------------------------- | --------------------------- | ||
| + | <WRAP right box 150px> | ||
| + | ** Usage: Column ** | ||
| + | </ | ||
| ==== DEFDATE ==== | ==== DEFDATE ==== | ||
| + | Indicates if the column (metaType **D** or **T**) should be defaulted to current date when a column is created. This differs from the **DEFTIMESTAMP** option below in that it only contains the date portion of a timestamp. | ||
| -------------------------- | -------------------------- | ||
| + | <WRAP right box 150px> | ||
| + | ** Usage: Column ** | ||
| + | </ | ||
| ==== DEFTIMESTAMP ==== | ==== DEFTIMESTAMP ==== | ||
| + | Indicates if the column (metaType **D** or **T**) should be defaulted to current timestamp when a column is created. | ||
| -------------------------- | -------------------------- | ||
| <WRAP right box 150px> | <WRAP right box 150px> | ||
| Line 81: | Line 82: | ||
| </ | </ | ||
| ==== ENUM ==== | ==== ENUM ==== | ||
| - | In databases that support the ENUM datatype, append a parenthesized, | + | In databases that support the //**ENUM**// datatype, append a parenthesized, | 
| ENUM(' | ENUM(' | ||
|  |  | ||
| Line 87: | Line 88: | ||
| ----------------------------------- | ----------------------------------- | ||
| + | <WRAP right box 150px> | ||
| + | **Usage: Column** | ||
| + | </ | ||
| ==== INDEX ==== | ==== INDEX ==== | ||
| + | Creates a single column index using the same name as the column, with ' | ||
| ------------------------------- | ------------------------------- | ||
| - | ==== KEY ==== | ||
| - | -------------------------------- | + | <WRAP right box 150px> | 
| + | ** Usage: Any ** | ||
| + | </ | ||
| ==== NOQUOTE ==== | ==== NOQUOTE ==== | ||
| + | Prevents ADOdb from applying the normal quoting rules to tables, columns and indexes. For example, a column name that contains a special character such as  // | ||
| -------------------------------- | -------------------------------- | ||
| <WRAP right box 150px> | <WRAP right box 150px> | ||
| Line 100: | Line 105: | ||
| </ | </ | ||
| ==== NOTNULL ==== | ==== NOTNULL ==== | ||
| + | Flags the column so that a NULL value cannot be inserted. For columns that are Auto-Increment or a Primary Key, this option is often implied. | ||
| ---------------------------- | ---------------------------- | ||
| <WRAP right box 150px> | <WRAP right box 150px> | ||
| - | **Usage: | + | **Usage: | 
| </ | </ | ||
| - | ==== PRIMARY ==== | + | ==== PRIMARY | 
| + | Indicates if the column is part of the [[wp> | ||
| --------------------------- | --------------------------- | ||
| <WRAP right box 150px> | <WRAP right box 150px> | ||
| - | ** Usage: | + | ** Usage: | 
| </ | </ | ||
| + | |||
| ==== UNIQUE ==== | ==== UNIQUE ==== | ||
| ** UNIQUE ** is an option against a key and indicates that duplicate values across all columns in the key are not allowed. | ** UNIQUE ** is an option against a key and indicates that duplicate values across all columns in the key are not allowed. | ||
| Line 117: | Line 124: | ||
| </ | </ | ||
| ==== UNSIGNED ==== | ==== UNSIGNED ==== | ||
| + | Creates an unsigned integer. | ||
v5/dictionary/column_attributes.1456702951.txt.gz · Last modified:  (external edit)
                
                