PHP Class dbTable, pkp-lib

Show file Open project: pkp/pkp-lib Class Usage Examples

Public Properties

Property Type Description
$current_field Field index: Keeps track of which field is currently being processed
$drop_field Mark field for destruction (not yet implemented)
$drop_table Mark table for destruction
$fields Field specifier: Meta-information about each field
$indexes List of table indexes.
$name Table name
$opts Table options: Table-level options

Public Methods

Method Description
_tag_cdata ( &$parser, $cdata ) XML Callback to process CDATA elements
_tag_close ( &$parser, $tag ) XML Callback to process end elements
_tag_open ( &$parser, $tag, $attributes ) XML Callback to process start elements. Elements currently processed are: INDEX, DROP, FIELD, KEY, NOTNULL, AUTOINCREMENT & DEFAULT.
addData ( array $attributes ) : object Adds data to a table object
addField ( string $name, string $type, string $size = NULL, array $opts = NULL ) : array Adds a field to a table object
addFieldOpt ( string $field, string $opt, mixed $value = NULL ) : array Adds a field option to the current field specifier
addIndex ( array $attributes ) : object Adds an index to a table object
addTableOpt ( string $opt ) : array Adds an option to the table
create ( object &$xmls ) : array Generates the SQL that will create the table in the database
dbTable ( &$parent, array $attributes = NULL ) Iniitializes a new table object.
drop ( ) Marks a field or table for destruction

Method Details

_tag_cdata() public method

XML Callback to process CDATA elements
public _tag_cdata ( &$parser, $cdata )

_tag_close() public method

XML Callback to process end elements
public _tag_close ( &$parser, $tag )

_tag_open() public method

XML Callback to process start elements. Elements currently processed are: INDEX, DROP, FIELD, KEY, NOTNULL, AUTOINCREMENT & DEFAULT.
public _tag_open ( &$parser, $tag, $attributes )

addData() public method

Adds data to a table object
public addData ( array $attributes ) : object
$attributes array Data attributes
return object dbData object

addField() public method

$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
public addField ( string $name, string $type, string $size = NULL, array $opts = NULL ) : array
$name string Name of the table to which the field will be added.
$type string ADODB datadict field type.
$size string Field size
$opts array Field options array
return array Field specifier array

addFieldOpt() public method

This method adds a field option allowed by the ADOdb datadict and appends it to the given field.
public addFieldOpt ( string $field, string $opt, mixed $value = NULL ) : array
$field string Field name
$opt string ADOdb field option
$value mixed Field option value
return array Field specifier array

addIndex() public method

Adds an index to a table object
public addIndex ( array $attributes ) : object
$attributes array Index attributes
return object dbIndex object

addTableOpt() public method

This method takes a comma-separated list of table-level options and appends them to the table object.
public addTableOpt ( string $opt ) : array
$opt string Table option
return array Options

create() public method

Generates the SQL that will create the table in the database
public create ( object &$xmls ) : array
$xmls object adoSchema object
return array Array containing table creation SQL

dbTable() public method

Iniitializes a new table object.
public dbTable ( &$parent, array $attributes = NULL )
$attributes array Array of table attributes.

drop() public method

Marks a field or table for destruction
public drop ( )

Property Details

$current_field public property

Field index: Keeps track of which field is currently being processed
public $current_field

$drop_field public property

Mark field for destruction (not yet implemented)
public $drop_field

$drop_table public property

Mark table for destruction
public $drop_table

$fields public property

Field specifier: Meta-information about each field
public $fields

$indexes public property

List of table indexes.
public $indexes

$name public property

Table name
public $name

$opts public property

Table options: Table-level options
public $opts