ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:dictionary:column_attributes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:dictionary:column_attributes [2016/01/30 17:09] – [DEFTIMESTAMP] mnewnhamv5:dictionary:column_attributes [2022/09/02 04:11] (current) – [Column Name] backticks mnewnham
Line 1: Line 1:
 ======= Dictionary Column Attributes ======= ======= Dictionary Column Attributes =======
-<WRAP todo> 
-Add Argument Definitions 
-</WRAP> 
 ====== Description ====== ====== Description ======
 When creating a column in a table using the dictionary methods, the information provided must confirm to the following specification. Each column created has a number of mandatory and optional parameters. When creating a column in a table using the dictionary methods, the information provided must confirm to the following specification. Each column created has a number of mandatory and optional parameters.
--------------------------------- +
-<WRAP right info 300px> +
-$fields is a string, not an array +
-</WRAP>+
 ====== Basic Syntax ====== ====== Basic Syntax ======
 The basic syntax of the attributes is as follows:  The basic syntax of the attributes is as follows: 
Line 44: Line 38:
 =======  Attributes ===== =======  Attributes =====
 ===== 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. If the name contains spaces, then it should be surrounded by backticks '' `col with spaces` ''. Note that this is an internal designator, and does not represent the character used by the database in SQL statements.                                                          
- +
 ===== Meta Attributes ===== ===== Meta Attributes =====
   * The column attributes in terms of type and length **must** be specified in terms of ADODb [[v5:dictionary:metatype|metaType]] descriptions, not the database definition for the type.   * The column attributes in terms of type and length **must** be specified in terms of ADODb [[v5:dictionary:metatype|metaType]] descriptions, not the database definition for the type.
Line 51: Line 44:
 The following optional arguments may also be assigned to the column, table or key. If the attribute is inappropriate for the operation or column type or not supported by the DBMS, it is ignored. The following optional arguments may also be assigned to the column, table or key. If the attribute is inappropriate for the operation or column type or not supported by the DBMS, it is ignored.
  
----------------+----------------------------
 <WRAP right box 150px> <WRAP right box 150px>
 ** Usage: Column ** ** Usage: Column **
 </WRAP> </WRAP>
-==== AUTO ==== +==== 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
-==== AUTOINCREMENT ==== + 
-Autoincrement is a synonym for **AUTO** +-----------------------
------------------+
 <WRAP right box 150px> <WRAP right box 150px>
 ** Usage: Index ** ** Usage: Index **
 </WRAP> </WRAP>
 ==== 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>
 **Usage: Column** **Usage: Column**
 </WRAP> </WRAP>
-==== DEF ==== +==== 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, see the options below. 
-==== DEFAULT ==== +--------------------------- 
-**DEFAULT** is a synonym for **DEF**+<WRAP right box 150px> 
 +** Usage: Column ** 
 +</WRAP>
 ==== 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 **
 +</WRAP>
 ==== 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> 
 +**Usage: Column** 
 +</WRAP>
 ==== ENUM ==== ==== ENUM ====
-In database that support the ENUM datatype, append a parenthasized, quoted list of enum values +In databases that support the //**ENUM**// datatype, append a parenthesized, quoted list of enum values 
   ENUM('lions','tigers','halibut')   ENUM('lions','tigers','halibut')
 +  
 +Note that you should not place a space between ENUM and the left parenthises ''(''
  
 +-----------------------------------
 +<WRAP right box 150px>
 +**Usage: Column**
 +</WRAP>
 ==== INDEX ==== ==== INDEX ====
-==== KEY ====+Creates a single column index using the same name as the column, with 'idx_' prepended to the name, e.g. a column of name ''column1'' will create an index of name ''idx_column1''
 +------------------------------- 
 + 
 +<WRAP right box 150px> 
 +** Usage: Any ** 
 +</WRAP>
 ==== 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  //**some-column**// will be automatically quoted to **//'some-column'//**. This tag prevents the behavior. 
 +--------------------------------
 <WRAP right box 150px> <WRAP right box 150px>
 ** Usage: Column ** ** Usage: Column **
 </WRAP> </WRAP>
 ==== 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: Index**+**Usage: Column**
 </WRAP> </WRAP>
-==== PRIMARY ==== +==== PRIMARY or KEY ==== 
----------------+Indicates if the column is part of the [[wp>Unique Key|Primary Key]] of the table. 
 +---------------------------
 <WRAP right box 150px> <WRAP right box 150px>
-** Usage: Index **+** Usage: Column**
 </WRAP> </WRAP>
 +
 ==== 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.
 +-------------------------
 +<WRAP right box 150px>
 +**Usage: Column **
 +</WRAP>
 ==== UNSIGNED ==== ==== UNSIGNED ====
 +Creates an unsigned integer.
v5/dictionary/column_attributes.1454170154.txt.gz · Last modified: 2017/04/21 11:29 (external edit)