\dbTable

Creates a table object in ADOdb's datadict format

This class stores information about a database table. As charactaristics of the table are loaded from the external source, methods and properties of this class are used to build up the table description in ADOdb's datadict format.

Summary

Methods
Properties
Constants
dbObject()
_tag_open()
_tag_cdata()
_tag_close()
create()
destroy()
supportedPlatform()
prefix()
FieldID()
dbTable()
addIndex()
addData()
addField()
addFieldOpt()
addTableOpt()
drop()
$parent
$currentElement
$name
$fields
$indexes
$opts
$current_field
$drop_table
$drop_field
$currentPlatform
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$parent

$parent : 

var object Parent

Type

$currentElement

$currentElement : 

var string current element

Type

$name

$name : string

Type

string — Table name

$fields

$fields : array

Type

array — Field specifier: Meta-information about each field

$indexes

$indexes : array

Type

array — List of table indexes.

$opts

$opts : array

Type

array — Table options: Table-level options

$current_field

$current_field : string

Type

string — Field index: Keeps track of which field is currently being processed

$drop_table

$drop_table : boolean

Type

boolean — Mark table for destruction

$drop_field

$drop_field : boolean

Type

boolean — Mark field for destruction (not yet implemented)

$currentPlatform

$currentPlatform : array

Type

array — Platform-specific options

Methods

dbObject()

dbObject(  $parent,   $attributes = NULL) 

NOP

Parameters

$parent
$attributes

_tag_open()

_tag_open(  $parser,   $tag,   $attributes) 

XML Callback to process start elements. Elements currently processed are: INDEX, DROP, FIELD, KEY, NOTNULL, AUTOINCREMENT & DEFAULT.

Parameters

$parser
$tag
$attributes

_tag_cdata()

_tag_cdata(  $parser,   $cdata) 

XML Callback to process CDATA elements

Parameters

$parser
$cdata

_tag_close()

_tag_close(  $parser,   $tag) 

XML Callback to process end elements

Parameters

$parser
$tag

create()

create(object  $xmls) : array

Generates the SQL that will create the table in the database

Parameters

object $xmls

adoSchema object

Returns

array —

Array containing table creation SQL

destroy()

destroy() 

Destroys the object

supportedPlatform()

supportedPlatform(string  $platform = NULL) : boolean

Checks whether the specified RDBMS is supported by the current database object or its ranking ancestor.

Parameters

string $platform

RDBMS platform name (from ADODB platform list).

Returns

boolean —

TRUE if RDBMS is supported; otherwise returns FALSE.

prefix()

prefix(string  $name = '') : string

Returns the prefix set by the ranking ancestor of the database object.

Parameters

string $name

Prefix string.

Returns

string —

Prefix.

FieldID()

FieldID(string  $field) : string

Extracts a field ID from the specified field.

Parameters

string $field

Field.

Returns

string —

Field ID.

dbTable()

dbTable(  $parent, array  $attributes = NULL) 

Iniitializes a new table object.

Parameters

$parent
array $attributes

Array of table attributes.

addIndex()

addIndex(array  $attributes) : object

Adds an index to a table object

Parameters

array $attributes

Index attributes

Returns

object —

dbIndex object

addData()

addData(array  $attributes) : object

Adds data to a table object

Parameters

array $attributes

Data attributes

Returns

object —

dbData object

addField()

addField(string  $name, string  $type, string  $size = NULL, array  $opts = NULL) : array

Adds a field to a table object

$name is the name of the table to which the field should be added. $type is an ADODB datadict field type. The following field types are supported as of ADODB 3.40:

  • C: varchar
    • X: CLOB (character large object) or largest varchar size if CLOB is not supported
    • C2: Multibyte varchar
    • X2: Multibyte CLOB
    • B: BLOB (binary large object)
    • D: Date (some databases do not support this, and we return a datetime type)
    • T: Datetime or Timestamp
    • L: Integer field suitable for storing booleans (0 or 1)
    • I: Integer (mapped to I4)
    • I1: 1-byte integer
    • I2: 2-byte integer
    • I4: 4-byte integer
    • I8: 8-byte integer
    • F: Floating point number
    • N: Numeric or decimal number

Parameters

string $name

Name of the table to which the field will be added.

string $type

ADODB datadict field type.

string $size

Field size

array $opts

Field options array

Returns

array —

Field specifier array

addFieldOpt()

addFieldOpt(string  $field, string  $opt, mixed  $value = NULL) : array

Adds a field option to the current field specifier

This method adds a field option allowed by the ADOdb datadict and appends it to the given field.

Parameters

string $field

Field name

string $opt

ADOdb field option

mixed $value

Field option value

Returns

array —

Field specifier array

addTableOpt()

addTableOpt(string  $opt) : array

Adds an option to the table

This method takes a comma-separated list of table-level options and appends them to the table object.

Parameters

string $opt

Table option

Returns

array —

Options

drop()

drop() 

Marks a field or table for destruction