- skip to content

# Database Abstraction Layer

### User Tools

- Login

### Site Tools

- Recent changes
- Media Manager
- Sitemap

### Sidebar

##### Resources

- Reference Manual
- User Guide
- The Data Dictionary
- ADOdb-xmlschema
- ADOdb Active Record
- Performance Monitoring
- Date/Time Library
- Session Management Library
- Unsupported Addons
- Coding Standards

##### Supported Databases

- Access
- ADO
- CSV
- Firebird
- Frontbase
- IBM DB2
- Informix
- Interbase
- LDAP
- Microsoft SQL Server
- MySQL
- Netezza
- ODBC
- ODBTP
- Oracle
- PDO
- Postgresql
- SAP ADS
- SAP ASE
- SAP Maxdb
- SAP Sqlanywhere
- Sqlite
- Sybase
- Plain Text
- Visual Foxpro

##### Other

- Feature Comparison Matrix
- Connection Matrix
- Include File Guide

v5:dictionary:column_attributes

# Dictionary Column Attributes

Add Argument Definitions

# 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.

$fields is a string, not an array

# Basic Syntax

The basic syntax of the attributes is as follows:

- All the information for the column must occur on a single line.
- The line ending may be a newline or carriage return/newline combination.
- Each attribute must be separated by at least one tab or space.
- The attributes must be specified in the order below
  1. Column Name
  2. Meta Attributes
  3. Optional Arguments

    /*
     * Correct syntax
     */
    $flds = "
    COL1 C(60) NOTNULL DEFAULT 'abc',
    COL2 I8 NOTNULL DEFAULT 0
    ";

    /*
     * Incorrect syntax
     */
    $flds = "
    COL1
    C(60)
    NOTNULL
    DEFAULT 'abc',
    COL2
    I8
    NOTNULL
    DEFAULT 0
    ";

# Attributes

## Column Name

- The column name must conform to any database specific standards related to naming and length.
- If required, use metaCasing to control the casing and optional quoting.

## Meta Attributes

- The column attributes in terms of type and length must be specified in terms of ADODb metaType descriptions, not the database definition for the type.

## Optional Arguments

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.

Usage: Column

### AUTO

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.

### AUTOINCREMENT

Autoincrement is a synonym for AUTO

Usage: Index

### CONSTRAINT

Usage: Column

### DEF

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

### DEFAULT

DEFAULT is a synonym for DEF

### DEFDATE

### DEFTIMESTAMP

### INDEX

### KEY

### NOQUOTE

Usage: Column

### NOTNULL

Usage: Index

### PRIMARY

Usage: Index

### UNIQUE

UNIQUE is an option against a key and indicates that duplicate values across all columns in the key are not allowed.

### UNSIGNED

v5/dictionary/column_attributes.txt · Last modified: 2016/01/12 17:06 by mnewnham

### Page Tools

- Show pagesource
- Old revisions
- Backlinks
- Rename Page
- Back to top