diff options
| author | Damien Regad <dregad@mantisbt.org> | 2021-10-25 18:16:12 +0200 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2021-10-25 18:16:12 +0200 |
| commit | a1433fedb37baaa1487ba0a7e533c8cc8d99bb14 (patch) | |
| tree | 69b17af3c2c7d04207a1ec6d2edd9438e1f6817c /adodb-xmlschema03.inc.php | |
| parent | 197cef7e17f093aca53dd681758770bc7b2d1542 (diff) | |
| download | adodb-a1433fedb37baaa1487ba0a7e533c8cc8d99bb14.tar.gz adodb-a1433fedb37baaa1487ba0a7e533c8cc8d99bb14.tar.bz2 adodb-a1433fedb37baaa1487ba0a7e533c8cc8d99bb14.zip | |
Fix PHPDoc blocks
Diffstat (limited to 'adodb-xmlschema03.inc.php')
| -rw-r--r-- | adodb-xmlschema03.inc.php | 1359 |
1 files changed, 682 insertions, 677 deletions
diff --git a/adodb-xmlschema03.inc.php b/adodb-xmlschema03.inc.php index 4ab6f89b..ba7500d0 100644 --- a/adodb-xmlschema03.inc.php +++ b/adodb-xmlschema03.inc.php @@ -27,59 +27,59 @@ */ /** -* Debug on or off -*/ + * Debug on or off + */ if( !defined( 'XMLS_DEBUG' ) ) { define( 'XMLS_DEBUG', FALSE ); } /** -* Default prefix key -*/ + * Default prefix key + */ if( !defined( 'XMLS_PREFIX' ) ) { define( 'XMLS_PREFIX', '%%P' ); } /** -* Maximum length allowed for object prefix -*/ + * Maximum length allowed for object prefix + */ if( !defined( 'XMLS_PREFIX_MAXLEN' ) ) { define( 'XMLS_PREFIX_MAXLEN', 10 ); } /** -* Execute SQL inline as it is generated -*/ + * Execute SQL inline as it is generated + */ if( !defined( 'XMLS_EXECUTE_INLINE' ) ) { define( 'XMLS_EXECUTE_INLINE', FALSE ); } /** -* Continue SQL Execution if an error occurs? -*/ + * Continue SQL Execution if an error occurs? + */ if( !defined( 'XMLS_CONTINUE_ON_ERROR' ) ) { define( 'XMLS_CONTINUE_ON_ERROR', FALSE ); } /** -* Current Schema Version -*/ + * Current Schema Version + */ if( !defined( 'XMLS_SCHEMA_VERSION' ) ) { define( 'XMLS_SCHEMA_VERSION', '0.3' ); } /** -* Default Schema Version. Used for Schemas without an explicit version set. -*/ + * Default Schema Version. Used for Schemas without an explicit version set. + */ if( !defined( 'XMLS_DEFAULT_SCHEMA_VERSION' ) ) { define( 'XMLS_DEFAULT_SCHEMA_VERSION', '0.1' ); } /** -* How to handle data rows that already exist in a database during and upgrade. -* Options are INSERT (attempts to insert duplicate rows), UPDATE (updates existing -* rows) and IGNORE (ignores existing rows). -*/ + * How to handle data rows that already exist in a database during and upgrade. + * Options are INSERT (attempts to insert duplicate rows), UPDATE (updates existing + * rows) and IGNORE (ignores existing rows). + */ if( !defined( 'XMLS_MODE_INSERT' ) ) { define( 'XMLS_MODE_INSERT', 0 ); } @@ -94,69 +94,69 @@ if( !defined( 'XMLS_EXISTING_DATA' ) ) { } /** -* Default Schema Version. Used for Schemas without an explicit version set. -*/ + * Default Schema Version. Used for Schemas without an explicit version set. + */ if( !defined( 'XMLS_DEFAULT_UPGRADE_METHOD' ) ) { define( 'XMLS_DEFAULT_UPGRADE_METHOD', 'ALTER' ); } /** -* Include the main ADODB library -*/ + * Include the main ADODB library + */ if( !defined( '_ADODB_LAYER' ) ) { require( 'adodb.inc.php' ); require( 'adodb-datadict.inc.php' ); } /** -* Abstract DB Object. This class provides basic methods for database objects, such -* as tables and indexes. -* -* @package axmls -* @access private -*/ + * Abstract DB Object. This class provides basic methods for database objects, such + * as tables and indexes. + * + * @package axmls + * @access private + */ class dbObject { /** - * var object Parent - */ + * var object Parent + */ var $parent; /** - * var string current element - */ + * var string current element + */ var $currentElement; /** - * NOP - */ + * NOP + */ function __construct( $parent, $attributes = NULL ) { $this->parent = $parent; } /** - * XML Callback to process start elements - * - * @access private - */ + * XML Callback to process start elements + * + * @access private + */ function _tag_open( $parser, $tag, $attributes ) { } /** - * XML Callback to process CDATA elements - * - * @access private - */ + * XML Callback to process CDATA elements + * + * @access private + */ function _tag_cdata( $parser, $cdata ) { } /** - * XML Callback to process end elements - * - * @access private - */ + * XML Callback to process end elements + * + * @access private + */ function _tag_close( $parser, $tag ) { } @@ -166,117 +166,117 @@ class dbObject { } /** - * Destroys the object - */ + * Destroys the object + */ function destroy() { } /** - * Checks whether the specified RDBMS is supported by the current - * database object or its ranking ancestor. - * - * @param string $platform RDBMS platform name (from ADODB platform list). - * @return boolean TRUE if RDBMS is supported; otherwise returns FALSE. - */ + * Checks whether the specified RDBMS is supported by the current + * database object or its ranking ancestor. + * + * @param string $platform RDBMS platform name (from ADODB platform list). + * @return boolean TRUE if RDBMS is supported; otherwise returns FALSE. + */ function supportedPlatform( $platform = NULL ) { return is_object( $this->parent ) ? $this->parent->supportedPlatform( $platform ) : TRUE; } /** - * Returns the prefix set by the ranking ancestor of the database object. - * - * @param string $name Prefix string. - * @return string Prefix. - */ + * Returns the prefix set by the ranking ancestor of the database object. + * + * @param string $name Prefix string. + * @return string Prefix. + */ function prefix( $name = '' ) { return is_object( $this->parent ) ? $this->parent->prefix( $name ) : $name; } /** - * Extracts a field ID from the specified field. - * - * @param string $field Field. - * @return string Field ID. - */ + * Extracts a field ID from the specified field. + * + * @param string $field Field. + * @return string Field ID. + */ function fieldID( $field ) { return strtoupper( preg_replace( '/^`(.+)`$/', '$1', $field ) ); } } /** -* 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. -* -* @package axmls -* @access private -*/ + * 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. + * + * @package axmls + * @access private + */ class dbTable extends dbObject { /** - * @var string Table name - */ + * @var string Table name + */ var $name; /** - * @var array Field specifier: Meta-information about each field - */ + * @var array Field specifier: Meta-information about each field + */ var $fields = array(); /** - * @var array List of table indexes. - */ + * @var array List of table indexes. + */ var $indexes = array(); /** - * @var array Table options: Table-level options - */ + * @var array Table options: Table-level options + */ var $opts = array(); /** - * @var string Field index: Keeps track of which field is currently being processed - */ + * @var string Field index: Keeps track of which field is currently being processed + */ var $current_field; /** - * @var boolean Mark table for destruction - * @access private - */ + * @var boolean Mark table for destruction + * @access private + */ var $drop_table; /** - * @var boolean Mark field for destruction (not yet implemented) - * @access private - */ + * @var boolean Mark field for destruction (not yet implemented) + * @access private + */ var $drop_field = array(); /** - * @var array Platform-specific options - * @access private - */ + * @var array Platform-specific options + * @access private + */ var $currentPlatform = true; /** - * Iniitializes a new table object. - * - * @param string $prefix DB Object prefix - * @param array $attributes Array of table attributes. - */ + * Iniitializes a new table object. + * + * @param string $prefix DB Object prefix + * @param array $attributes Array of table attributes. + */ function __construct( $parent, $attributes = NULL ) { $this->parent = $parent; $this->name = $this->prefix($attributes['NAME']); } /** - * XML Callback to process start elements. Elements currently - * processed are: INDEX, DROP, FIELD, KEY, NOTNULL, AUTOINCREMENT & DEFAULT. - * - * @access private - */ + * XML Callback to process start elements. Elements currently + * processed are: INDEX, DROP, FIELD, KEY, NOTNULL, AUTOINCREMENT & DEFAULT. + * + * @access private + */ function _tag_open( $parser, $tag, $attributes ) { $this->currentElement = strtoupper( $tag ); @@ -335,10 +335,10 @@ class dbTable extends dbObject { } /** - * XML Callback to process CDATA elements - * - * @access private - */ + * XML Callback to process CDATA elements + * + * @access private + */ function _tag_cdata( $parser, $cdata ) { switch( $this->currentElement ) { // Table or field comment @@ -371,10 +371,10 @@ class dbTable extends dbObject { } /** - * XML Callback to process end elements - * - * @access private - */ + * XML Callback to process end elements + * + * @access private + */ function _tag_close( $parser, $tag ) { $this->currentElement = ''; @@ -397,11 +397,11 @@ class dbTable extends dbObject { } /** - * Adds an index to a table object - * - * @param array $attributes Index attributes - * @return object dbIndex object - */ + * Adds an index to a table object + * + * @param array $attributes Index attributes + * @return object dbIndex object + */ function addIndex( $attributes ) { $name = strtoupper( $attributes['NAME'] ); $this->indexes[$name] = new dbIndex( $this, $attributes ); @@ -409,11 +409,11 @@ class dbTable extends dbObject { } /** - * Adds data to a table object - * - * @param array $attributes Data attributes - * @return object dbData object - */ + * Adds data to a table object + * + * @param array $attributes Data attributes + * @return object dbData object + */ function addData( $attributes ) { if( !isset( $this->data ) ) { $this->data = new dbData( $this, $attributes ); @@ -422,34 +422,34 @@ class dbTable extends dbObject { } /** - * 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 - * - * @param string $name Name of the table to which the field will be added. - * @param string $type ADODB datadict field type. - * @param string $size Field size - * @param array $opts Field options array - * @return array Field specifier 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 + * + * @param string $name Name of the table to which the field will be added. + * @param string $type ADODB datadict field type. + * @param string $size Field size + * @param array $opts Field options array + * @return array Field specifier array + */ function addField( $name, $type, $size = NULL, $opts = NULL ) { $field_id = $this->fieldID( $name ); @@ -476,16 +476,16 @@ class dbTable extends dbObject { } /** - * 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. - * - * @param string $field Field name - * @param string $opt ADOdb field option - * @param mixed $value Field option value - * @return array Field specifier 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. + * + * @param string $field Field name + * @param string $opt ADOdb field option + * @param mixed $value Field option value + * @return array Field specifier array + */ function addFieldOpt( $field, $opt, $value = NULL ) { if( $this->currentPlatform ) { if( !isset( $value ) ) { @@ -498,14 +498,14 @@ class dbTable extends dbObject { } /** - * Adds an option to the table - * - * This method takes a comma-separated list of table-level options - * and appends them to the table object. - * - * @param string $opt Table option - * @return array Options - */ + * Adds an option to the table + * + * This method takes a comma-separated list of table-level options + * and appends them to the table object. + * + * @param string $opt Table option + * @return array Options + */ function addTableOpt( $opt ) { if(isset($this->currentPlatform)) { $this->opts[$this->parent->db->dataProvider] = $opt; @@ -519,11 +519,11 @@ class dbTable extends dbObject { } /** - * Generates the SQL that will create the table in the database - * - * @param object $xmls adoSchema object - * @return array Array containing table creation SQL - */ + * Generates the SQL that will create the table in the database + * + * @param object $xmls adoSchema object + * @return array Array containing table creation SQL + */ function create( &$xmls ) { $sql = array(); @@ -631,8 +631,8 @@ class dbTable extends dbObject { } /** - * Marks a field or table for destruction - */ + * Marks a field or table for destruction + */ function drop() { if( isset( $this->current_field ) ) { // Drop the current field @@ -649,47 +649,47 @@ class dbTable extends dbObject { } /** -* Creates an index object in ADOdb's datadict format -* -* This class stores information about a database index. As charactaristics -* of the index are loaded from the external source, methods and properties -* of this class are used to build up the index description in ADOdb's -* datadict format. -* -* @package axmls -* @access private -*/ + * Creates an index object in ADOdb's datadict format + * + * This class stores information about a database index. As charactaristics + * of the index are loaded from the external source, methods and properties + * of this class are used to build up the index description in ADOdb's + * datadict format. + * + * @package axmls + * @access private + */ class dbIndex extends dbObject { /** - * @var string Index name - */ + * @var string Index name + */ var $name; /** - * @var array Index options: Index-level options - */ + * @var array Index options: Index-level options + */ var $opts = array(); /** - * @var array Indexed fields: Table columns included in this index - */ + * @var array Indexed fields: Table columns included in this index + */ var $columns = array(); /** - * @var boolean Mark index for destruction - * @access private - */ + * @var boolean Mark index for destruction + * @access private + */ var $drop = FALSE; /** - * Initializes the new dbIndex object. - * - * @param object $parent Parent object - * @param array $attributes Attributes - * - * @internal - */ + * Initializes the new dbIndex object. + * + * @param object $parent Parent object + * @param array $attributes Attributes + * + * @internal + */ function __construct( $parent, $attributes = NULL ) { $this->parent = $parent; @@ -697,13 +697,13 @@ class dbIndex extends dbObject { } /** - * XML Callback to process start elements - * - * Processes XML opening tags. - * Elements currently processed are: DROP, CLUSTERED, BITMAP, UNIQUE, FULLTEXT & HASH. - * - * @access private - */ + * XML Callback to process start elements + * + * Processes XML opening tags. + * Elements currently processed are: DROP, CLUSTERED, BITMAP, UNIQUE, FULLTEXT & HASH. + * + * @access private + */ function _tag_open( $parser, $tag, $attributes ) { $this->currentElement = strtoupper( $tag ); @@ -725,12 +725,12 @@ class dbIndex extends dbObject { } /** - * XML Callback to process CDATA elements - * - * Processes XML cdata. - * - * @access private - */ + * XML Callback to process CDATA elements + * + * Processes XML cdata. + * + * @access private + */ function _tag_cdata( $parser, $cdata ) { switch( $this->currentElement ) { // Index field name @@ -743,10 +743,10 @@ class dbIndex extends dbObject { } /** - * XML Callback to process end elements - * - * @access private - */ + * XML Callback to process end elements + * + * @access private + */ function _tag_close( $parser, $tag ) { $this->currentElement = ''; @@ -758,11 +758,11 @@ class dbIndex extends dbObject { } /** - * Adds a field to the index - * - * @param string $name Field name - * @return string Field list - */ + * Adds a field to the index + * + * @param string $name Field name + * @return string Field list + */ function addField( $name ) { $this->columns[$this->fieldID( $name )] = $name; @@ -771,11 +771,11 @@ class dbIndex extends dbObject { } /** - * Adds options to the index - * - * @param string $opt Comma-separated list of index options. - * @return string Option list - */ + * Adds options to the index + * + * @param string $opt Comma-separated list of index options. + * @return string Option list + */ function addIndexOpt( $opt ) { $this->opts[] = $opt; @@ -784,11 +784,11 @@ class dbIndex extends dbObject { } /** - * Generates the SQL that will create the index in the database - * - * @param object $xmls adoSchema object - * @return array Array containing index creation SQL - */ + * Generates the SQL that will create the index in the database + * + * @param object $xmls adoSchema object + * @return array Array containing index creation SQL + */ function create( &$xmls ) { if( $this->drop ) { return NULL; @@ -805,22 +805,22 @@ class dbIndex extends dbObject { } /** - * Marks an index for destruction - */ + * Marks an index for destruction + */ function drop() { $this->drop = TRUE; } } /** -* Creates a data object in ADOdb's datadict format -* -* This class stores information about table data, and is called -* when we need to load field data into a table. -* -* @package axmls -* @access private -*/ + * Creates a data object in ADOdb's datadict format + * + * This class stores information about table data, and is called + * when we need to load field data into a table. + * + * @package axmls + * @access private + */ class dbData extends dbObject { var $data = array(); @@ -828,25 +828,25 @@ class dbData extends dbObject { var $row; /** - * Initializes the new dbData object. - * - * @param object $parent Parent object - * @param array $attributes Attributes - * - * @internal - */ + * Initializes the new dbData object. + * + * @param object $parent Parent object + * @param array $attributes Attributes + * + * @internal + */ function __construct( $parent, $attributes = NULL ) { $this->parent = $parent; } /** - * XML Callback to process start elements - * - * Processes XML opening tags. - * Elements currently processed are: ROW and F (field). - * - * @access private - */ + * XML Callback to process start elements + * + * Processes XML opening tags. + * Elements currently processed are: ROW and F (field). + * + * @access private + */ function _tag_open( $parser, $tag, $attributes ) { $this->currentElement = strtoupper( $tag ); @@ -863,12 +863,12 @@ class dbData extends dbObject { } /** - * XML Callback to process CDATA elements - * - * Processes XML cdata. - * - * @access private - */ + * XML Callback to process CDATA elements + * + * Processes XML cdata. + * + * @access private + */ function _tag_cdata( $parser, $cdata ) { switch( $this->currentElement ) { // Index field name @@ -881,10 +881,10 @@ class dbData extends dbObject { } /** - * XML Callback to process end elements - * - * @access private - */ + * XML Callback to process end elements + * + * @access private + */ function _tag_close( $parser, $tag ) { $this->currentElement = ''; @@ -896,11 +896,11 @@ class dbData extends dbObject { } /** - * Adds a field to the insert - * - * @param string $name Field name - * @return string Field list - */ + * Adds a field to the insert + * + * @param string $name Field name + * @return string Field list + */ function addField( $attributes ) { // check we're in a valid row if( !isset( $this->row ) || !isset( $this->data[$this->row] ) ) { @@ -921,11 +921,11 @@ class dbData extends dbObject { } /** - * Adds options to the index - * - * @param string $opt Comma-separated list of index options. - * @return string Option list - */ + * Adds options to the index + * + * @param string $opt Comma-separated list of index options. + * @return string Option list + */ function addData( $cdata ) { // check we're in a valid field if ( isset( $this->data[$this->row][$this->current_field] ) ) { @@ -935,11 +935,11 @@ class dbData extends dbObject { } /** - * Generates the SQL that will add/update the data in the database - * - * @param object $xmls adoSchema object - * @return array Array containing index creation SQL - */ + * Generates the SQL that will add/update the data in the database + * + * @param object $xmls adoSchema object + * @return array Array containing index creation SQL + */ function create( &$xmls ) { $table = $xmls->dict->tableName($this->parent->name); $table_field_count = count($this->parent->fields); @@ -1058,39 +1058,39 @@ class dbData extends dbObject { } /** -* Creates the SQL to execute a list of provided SQL queries -* -* @package axmls -* @access private -*/ + * Creates the SQL to execute a list of provided SQL queries + * + * @package axmls + * @access private + */ class dbQuerySet extends dbObject { /** - * @var array List of SQL queries - */ + * @var array List of SQL queries + */ var $queries = array(); /** - * @var string String used to build of a query line by line - */ + * @var string String used to build of a query line by line + */ var $query; /** - * @var string Query prefix key - */ + * @var string Query prefix key + */ var $prefixKey = ''; /** - * @var boolean Auto prefix enable (TRUE) - */ + * @var boolean Auto prefix enable (TRUE) + */ var $prefixMethod = 'AUTO'; /** - * Initializes the query set. - * - * @param object $parent Parent object - * @param array $attributes Attributes - */ + * Initializes the query set. + * + * @param object $parent Parent object + * @param array $attributes Attributes + */ function __construct( $parent, $attributes = NULL ) { $this->parent = $parent; @@ -1116,11 +1116,11 @@ class dbQuerySet extends dbObject { } /** - * XML Callback to process start elements. Elements currently - * processed are: QUERY. - * - * @access private - */ + * XML Callback to process start elements. Elements currently + * processed are: QUERY. + * + * @access private + */ function _tag_open( $parser, $tag, $attributes ) { $this->currentElement = strtoupper( $tag ); @@ -1141,8 +1141,8 @@ class dbQuerySet extends dbObject { } /** - * XML Callback to process CDATA elements - */ + * XML Callback to process CDATA elements + */ function _tag_cdata( $parser, $cdata ) { switch( $this->currentElement ) { // Line of queryset SQL data @@ -1155,10 +1155,10 @@ class dbQuerySet extends dbObject { } /** - * XML Callback to process end elements - * - * @access private - */ + * XML Callback to process end elements + * + * @access private + */ function _tag_close( $parser, $tag ) { $this->currentElement = ''; @@ -1178,10 +1178,10 @@ class dbQuerySet extends dbObject { } /** - * Re-initializes the query. - * - * @return boolean TRUE - */ + * Re-initializes the query. + * + * @return boolean TRUE + */ function newQuery() { $this->query = ''; @@ -1189,10 +1189,10 @@ class dbQuerySet extends dbObject { } /** - * Discards the existing query. - * - * @return boolean TRUE - */ + * Discards the existing query. + * + * @return boolean TRUE + */ function discardQuery() { unset( $this->query ); @@ -1200,11 +1200,11 @@ class dbQuerySet extends dbObject { } /** - * Appends a line to a query that is being built line by line - * - * @param string $data Line of SQL data or NULL to initialize a new query - * @return string SQL query string. - */ + * Appends a line to a query that is being built line by line + * + * @param string $data Line of SQL data or NULL to initialize a new query + * @return string SQL query string. + */ function buildQuery( $sql = NULL ) { if( !isset( $this->query ) OR empty( $sql ) ) { return FALSE; @@ -1216,10 +1216,10 @@ class dbQuerySet extends dbObject { } /** - * Adds a completed query to the query list - * - * @return string SQL of added query - */ + * Adds a completed query to the query list + * + * @return string SQL of added query + */ function addQuery() { if( !isset( $this->query ) ) { return FALSE; @@ -1233,11 +1233,11 @@ class dbQuerySet extends dbObject { } /** - * Creates and returns the current query set - * - * @param object $xmls adoSchema object - * @return array Query set - */ + * Creates and returns the current query set + * + * @param object $xmls adoSchema object + * @return array Query set + */ function create( &$xmls ) { foreach( $this->queries as $id => $query ) { switch( $this->prefixMethod ) { @@ -1273,13 +1273,13 @@ class dbQuerySet extends dbObject { } /** - * Rebuilds the query with the prefix attached to any objects - * - * @param string $regex Regex used to add prefix - * @param string $query SQL query string - * @param string $prefix Prefix to be appended to tables, indices, etc. - * @return string Prefixed SQL query string. - */ + * Rebuilds the query with the prefix attached to any objects + * + * @param string $regex Regex used to add prefix + * @param string $query SQL query string + * @param string $prefix Prefix to be appended to tables, indices, etc. + * @return string Prefixed SQL query string. + */ function prefixQuery( $regex, $query, $prefix = NULL ) { if( !isset( $prefix ) ) { return $query; @@ -1309,103 +1309,103 @@ class dbQuerySet extends dbObject { } /** -* Loads and parses an XML file, creating an array of "ready-to-run" SQL statements -* -* This class is used to load and parse the XML file, to create an array of SQL statements -* that can be used to build a database, and to build the database using the SQL array. -* -* @tutorial getting_started.pkg -* -* @author Richard Tango-Lowy & Dan Cech -* @version $Revision: 1.62 $ -* -* @package axmls -*/ + * Loads and parses an XML file, creating an array of "ready-to-run" SQL statements + * + * This class is used to load and parse the XML file, to create an array of SQL statements + * that can be used to build a database, and to build the database using the SQL array. + * + * @tutorial getting_started.pkg + * + * @author Richard Tango-Lowy & Dan Cech + * @version $Revision: 1.62 $ + * + * @package axmls + */ class adoSchema { /** - * @var array Array containing SQL queries to generate all objects - * @access private - */ + * @var array Array containing SQL queries to generate all objects + * @access private + */ var $sqlArray; /** - * @var object ADOdb connection object - * @access private - */ + * @var object ADOdb connection object + * @access private + */ var $db; /** - * @var object ADOdb Data Dictionary - * @access private - */ + * @var object ADOdb Data Dictionary + * @access private + */ var $dict; /** - * @var string Current XML element - * @access private - */ + * @var string Current XML element + * @access private + */ var $currentElement = ''; /** - * @var string If set (to 'ALTER' or 'REPLACE'), upgrade an existing database - * @access private - */ + * @var string If set (to 'ALTER' or 'REPLACE'), upgrade an existing database + * @access private + */ var $upgrade = ''; /** - * @var string Optional object prefix - * @access private - */ + * @var string Optional object prefix + * @access private + */ var $objectPrefix = ''; /** - * @var long System debug - * @access private - */ + * @var long System debug + * @access private + */ var $debug; /** - * @var string Regular expression to find schema version - * @access private - */ + * @var string Regular expression to find schema version + * @access private + */ var $versionRegex = '/<schema.*?( version="([^"]*)")?.*?>/'; /** - * @var string Current schema version - * @access private - */ + * @var string Current schema version + * @access private + */ var $schemaVersion; /** - * @var int Success of last Schema execution - */ + * @var int Success of last Schema execution + */ var $success; /** - * @var bool Execute SQL inline as it is generated - */ + * @var bool Execute SQL inline as it is generated + */ var $executeInline; /** - * @var bool Continue SQL execution if errors occur - */ + * @var bool Continue SQL execution if errors occur + */ var $continueOnError; /** - * @var int How to handle existing data rows (insert, update, or ignore) - */ + * @var int How to handle existing data rows (insert, update, or ignore) + */ var $existingData; /** - * Creates an adoSchema object - * - * Creating an adoSchema object is the first step in processing an XML schema. - * The only parameter is an ADOdb database connection object, which must already - * have been created. - * - * @param object $db ADOdb database connection object. - */ + * Creates an adoSchema object + * + * Creating an adoSchema object is the first step in processing an XML schema. + * The only parameter is an ADOdb database connection object, which must already + * have been created. + * + * @param object $db ADOdb database connection object. + */ function __construct( $db ) { $this->db = $db; $this->debug = $this->db->debug; @@ -1419,21 +1419,21 @@ class adoSchema { } /** - * Sets the method to be used for upgrading an existing database - * - * Use this method to specify how existing database objects should be upgraded. - * The method option can be set to ALTER, REPLACE, BEST, or NONE. ALTER attempts to - * alter each database object directly, REPLACE attempts to rebuild each object - * from scratch, BEST attempts to determine the best upgrade method for each - * object, and NONE disables upgrading. - * - * This method is not yet used by AXMLS, but exists for backward compatibility. - * The ALTER method is automatically assumed when the adoSchema object is - * instantiated; other upgrade methods are not currently supported. - * - * @param string $method Upgrade method (ALTER|REPLACE|BEST|NONE) - * @returns string Upgrade method used - */ + * Sets the method to be used for upgrading an existing database + * + * Use this method to specify how existing database objects should be upgraded. + * The method option can be set to ALTER, REPLACE, BEST, or NONE. ALTER attempts to + * alter each database object directly, REPLACE attempts to rebuild each object + * from scratch, BEST attempts to determine the best upgrade method for each + * object, and NONE disables upgrading. + * + * This method is not yet used by AXMLS, but exists for backward compatibility. + * The ALTER method is automatically assumed when the adoSchema object is + * instantiated; other upgrade methods are not currently supported. + * + * @param string $method Upgrade method (ALTER|REPLACE|BEST|NONE) + * @returns string Upgrade method used + */ function setUpgradeMethod( $method = '' ) { if( !is_string( $method ) ) { return FALSE; @@ -1464,24 +1464,24 @@ class adoSchema { } /** - * Specifies how to handle existing data row when there is a unique key conflict. - * - * The existingData setting specifies how the parser should handle existing rows - * when a unique key violation occurs during the insert. This can happen when inserting - * data into an existing table with one or more primary keys or unique indexes. - * The existingData method takes one of three options: XMLS_MODE_INSERT attempts - * to always insert the data as a new row. In the event of a unique key violation, - * the database will generate an error. XMLS_MODE_UPDATE attempts to update the - * any existing rows with the new data based upon primary or unique key fields in - * the schema. If the data row in the schema specifies no unique fields, the row - * data will be inserted as a new row. XMLS_MODE_IGNORE specifies that any data rows - * that would result in a unique key violation be ignored; no inserts or updates will - * take place. For backward compatibility, the default setting is XMLS_MODE_INSERT, - * but XMLS_MODE_UPDATE will generally be the most appropriate setting. - * - * @param int $mode XMLS_MODE_INSERT, XMLS_MODE_UPDATE, or XMLS_MODE_IGNORE - * @return int current mode - */ + * Specifies how to handle existing data row when there is a unique key conflict. + * + * The existingData setting specifies how the parser should handle existing rows + * when a unique key violation occurs during the insert. This can happen when inserting + * data into an existing table with one or more primary keys or unique indexes. + * The existingData method takes one of three options: XMLS_MODE_INSERT attempts + * to always insert the data as a new row. In the event of a unique key violation, + * the database will generate an error. XMLS_MODE_UPDATE attempts to update the + * any existing rows with the new data based upon primary or unique key fields in + * the schema. If the data row in the schema specifies no unique fields, the row + * data will be inserted as a new row. XMLS_MODE_IGNORE specifies that any data rows + * that would result in a unique key violation be ignored; no inserts or updates will + * take place. For backward compatibility, the default setting is XMLS_MODE_INSERT, + * but XMLS_MODE_UPDATE will generally be the most appropriate setting. + * + * @param int $mode XMLS_MODE_INSERT, XMLS_MODE_UPDATE, or XMLS_MODE_IGNORE + * @return int current mode + */ function existingData( $mode = NULL ) { if( is_int( $mode ) ) { switch( $mode ) { @@ -1505,18 +1505,19 @@ class adoSchema { } /** - * Enables/disables inline SQL execution. - * - * Call this method to enable or disable inline execution of the schema. If the mode is set to TRUE (inline execution), - * AXMLS applies the SQL to the database immediately as each schema entity is parsed. If the mode - * is set to FALSE (post execution), AXMLS parses the entire schema and you will need to call adoSchema::ExecuteSchema() - * to apply the schema to the database. - * - * @param bool $mode execute - * @return bool current execution mode - * - * @see ParseSchema(), ExecuteSchema() - */ + * Enables/disables inline SQL execution. + * + * Call this method to enable or disable inline execution of the schema. If the mode is set to TRUE (inline execution), + * AXMLS applies the SQL to the database immediately as each schema entity is parsed. If the mode + * is set to FALSE (post execution), AXMLS parses the entire schema and you will need to call adoSchema::ExecuteSchema() + * to apply the schema to the database. + * + * @param bool $mode execute + * @return bool current execution mode + * + * @see ParseSchema() + * @see ExecuteSchema() + */ function executeInline( $mode = NULL ) { if( is_bool( $mode ) ) { $this->executeInline = $mode; @@ -1526,18 +1527,19 @@ class adoSchema { } /** - * Enables/disables SQL continue on error. - * - * Call this method to enable or disable continuation of SQL execution if an error occurs. - * If the mode is set to TRUE (continue), AXMLS will continue to apply SQL to the database, even if an error occurs. - * If the mode is set to FALSE (halt), AXMLS will halt execution of generated sql if an error occurs, though parsing - * of the schema will continue. - * - * @param bool $mode execute - * @return bool current continueOnError mode - * - * @see addSQL(), ExecuteSchema() - */ + * Enables/disables SQL continue on error. + * + * Call this method to enable or disable continuation of SQL execution if an error occurs. + * If the mode is set to TRUE (continue), AXMLS will continue to apply SQL to the database, even if an error occurs. + * If the mode is set to FALSE (halt), AXMLS will halt execution of generated sql if an error occurs, though parsing + * of the schema will continue. + * + * @param bool $mode execute + * @return bool current continueOnError mode + * + * @see addSQL() + * @see ExecuteSchema() + */ function continueOnError( $mode = NULL ) { if( is_bool( $mode ) ) { $this->continueOnError = $mode; @@ -1547,43 +1549,44 @@ class adoSchema { } /** - * Loads an XML schema from a file and converts it to SQL. - * - * Call this method to load the specified schema (see the DTD for the proper format) from - * the filesystem and generate the SQL necessary to create the database - * described. This method automatically converts the schema to the latest - * axmls schema version. - * @see ParseSchemaString() - * - * @param string $file Name of XML schema file. - * @param bool $returnSchema Return schema rather than parsing. - * @return array Array of SQL queries, ready to execute - */ + * Loads an XML schema from a file and converts it to SQL. + * + * Call this method to load the specified schema (see the DTD for the proper format) from + * the filesystem and generate the SQL necessary to create the database + * described. This method automatically converts the schema to the latest + * axmls schema version. + * @see ParseSchemaString() + * + * @param string $file Name of XML schema file. + * @param bool $returnSchema Return schema rather than parsing. + * @return array Array of SQL queries, ready to execute + */ function parseSchema( $filename, $returnSchema = FALSE ) { return $this->parseSchemaString( $this->convertSchemaFile( $filename ), $returnSchema ); } /** - * Loads an XML schema from a file and converts it to SQL. - * - * Call this method to load the specified schema directly from a file (see - * the DTD for the proper format) and generate the SQL necessary to create - * the database described by the schema. Use this method when you are dealing - * with large schema files. Otherwise, parseSchema() is faster. - * This method does not automatically convert the schema to the latest axmls - * schema version. You must convert the schema manually using either the - * convertSchemaFile() or convertSchemaString() method. - * @see parseSchema() - * @see convertSchemaFile() - * @see convertSchemaString() - * - * @param string $file Name of XML schema file. - * @param bool $returnSchema Return schema rather than parsing. - * @return array Array of SQL queries, ready to execute. - * - * @deprecated Replaced by adoSchema::parseSchema() and adoSchema::parseSchemaString() - * @see parseSchema(), parseSchemaString() - */ + * Loads an XML schema from a file and converts it to SQL. + * + * Call this method to load the specified schema directly from a file (see + * the DTD for the proper format) and generate the SQL necessary to create + * the database described by the schema. Use this method when you are dealing + * with large schema files. Otherwise, parseSchema() is faster. + * This method does not automatically convert the schema to the latest axmls + * schema version. You must convert the schema manually using either the + * convertSchemaFile() or convertSchemaString() method. + * @see parseSchema() + * @see convertSchemaFile() + * @see convertSchemaString() + * + * @param string $file Name of XML schema file. + * @param bool $returnSchema Return schema rather than parsing. + * @return array Array of SQL queries, ready to execute. + * + * @deprecated Replaced by adoSchema::parseSchema() and adoSchema::parseSchemaString() + * @see parseSchema() + * @see parseSchemaString() + */ function parseSchemaFile( $filename, $returnSchema = FALSE ) { // Open the file if( !($fp = fopen( $filename, 'r' )) ) { @@ -1626,16 +1629,16 @@ class adoSchema { } /** - * Converts an XML schema string to SQL. - * - * Call this method to parse a string containing an XML schema (see the DTD for the proper format) - * and generate the SQL necessary to create the database described by the schema. - * @see parseSchema() - * - * @param string $xmlstring XML schema string. - * @param bool $returnSchema Return schema rather than parsing. - * @return array Array of SQL queries, ready to execute. - */ + * Converts an XML schema string to SQL. + * + * Call this method to parse a string containing an XML schema (see the DTD for the proper format) + * and generate the SQL necessary to create the database described by the schema. + * @see parseSchema() + * + * @param string $xmlstring XML schema string. + * @param bool $returnSchema Return schema rather than parsing. + * @return array Array of SQL queries, ready to execute. + */ function parseSchemaString( $xmlstring, $returnSchema = FALSE ) { if( !is_string( $xmlstring ) OR empty( $xmlstring ) ) { logMsg( 'Empty or Invalid Schema' ); @@ -1670,31 +1673,31 @@ class adoSchema { } /** - * Loads an XML schema from a file and converts it to uninstallation SQL. - * - * Call this method to load the specified schema (see the DTD for the proper format) from - * the filesystem and generate the SQL necessary to remove the database described. - * @see RemoveSchemaString() - * - * @param string $file Name of XML schema file. - * @param bool $returnSchema Return schema rather than parsing. - * @return array Array of SQL queries, ready to execute - */ + * Loads an XML schema from a file and converts it to uninstallation SQL. + * + * Call this method to load the specified schema (see the DTD for the proper format) from + * the filesystem and generate the SQL necessary to remove the database described. + * @see RemoveSchemaString() + * + * @param string $file Name of XML schema file. + * @param bool $returnSchema Return schema rather than parsing. + * @return array Array of SQL queries, ready to execute + */ function removeSchema( $filename, $returnSchema = FALSE ) { return $this->removeSchemaString( $this->convertSchemaFile( $filename ), $returnSchema ); } /** - * Converts an XML schema string to uninstallation SQL. - * - * Call this method to parse a string containing an XML schema (see the DTD for the proper format) - * and generate the SQL necessary to uninstall the database described by the schema. - * @see removeSchema() - * - * @param string $schema XML schema string. - * @param bool $returnSchema Return schema rather than parsing. - * @return array Array of SQL queries, ready to execute. - */ + * Converts an XML schema string to uninstallation SQL. + * + * Call this method to parse a string containing an XML schema (see the DTD for the proper format) + * and generate the SQL necessary to uninstall the database described by the schema. + * @see removeSchema() + * + * @param string $schema XML schema string. + * @param bool $returnSchema Return schema rather than parsing. + * @return array Array of SQL queries, ready to execute. + */ function removeSchemaString( $schema, $returnSchema = FALSE ) { // grab current version @@ -1706,18 +1709,20 @@ class adoSchema { } /** - * Applies the current XML schema to the database (post execution). - * - * Call this method to apply the current schema (generally created by calling - * parseSchema() or parseSchemaString() ) to the database (creating the tables, indexes, - * and executing other SQL specified in the schema) after parsing. - * @see parseSchema(), parseSchemaString(), executeInline() - * - * @param array $sqlArray Array of SQL statements that will be applied rather than - * the current schema. - * @param boolean $continueOnErr Continue to apply the schema even if an error occurs. - * @returns integer 0 if failure, 1 if errors, 2 if successful. - */ + * Applies the current XML schema to the database (post execution). + * + * Call this method to apply the current schema (generally created by calling + * parseSchema() or parseSchemaString() ) to the database (creating the tables, indexes, + * and executing other SQL specified in the schema) after parsing. + * @see parseSchema() + * @see parseSchemaString() + * @see executeInline() + * + * @param array $sqlArray Array of SQL statements that will be applied rather than + * the current schema. + * @param boolean $continueOnErr Continue to apply the schema even if an error occurs. + * @returns integer 0 if failure, 1 if errors, 2 if successful. + */ function executeSchema( $sqlArray = NULL, $continueOnErr = NULL ) { if( !is_bool( $continueOnErr ) ) { $continueOnErr = $this->continueOnError(); @@ -1737,28 +1742,28 @@ class adoSchema { } /** - * Returns the current SQL array. - * - * Call this method to fetch the array of SQL queries resulting from - * parseSchema() or parseSchemaString(). - * - * @param string $format Format: HTML, TEXT, or NONE (PHP array) - * @return array Array of SQL statements or FALSE if an error occurs - */ + * Returns the current SQL array. + * + * Call this method to fetch the array of SQL queries resulting from + * parseSchema() or parseSchemaString(). + * + * @param string $format Format: HTML, TEXT, or NONE (PHP array) + * @return array Array of SQL statements or FALSE if an error occurs + */ function printSQL( $format = 'NONE' ) { $sqlArray = null; return $this->getSQL( $format, $sqlArray ); } /** - * Saves the current SQL array to the local filesystem as a list of SQL queries. - * - * Call this method to save the array of SQL queries (generally resulting from a - * parsed XML schema) to the filesystem. - * - * @param string $filename Path and name where the file should be saved. - * @return boolean TRUE if save is successful, else FALSE. - */ + * Saves the current SQL array to the local filesystem as a list of SQL queries. + * + * Call this method to save the array of SQL queries (generally resulting from a + * parsed XML schema) to the filesystem. + * + * @param string $filename Path and name where the file should be saved. + * @return boolean TRUE if save is successful, else FALSE. + */ function saveSQL( $filename = './schema.sql' ) { if( !isset( $sqlArray ) ) { @@ -1777,12 +1782,12 @@ class adoSchema { } /** - * Create an xml parser - * - * @return object PHP XML parser object - * - * @access private - */ + * Create an xml parser + * + * @return object PHP XML parser object + * + * @access private + */ function create_parser() { // Create the parser $xmlParser = xml_parser_create(); @@ -1796,10 +1801,10 @@ class adoSchema { } /** - * XML Callback to process start elements - * - * @access private - */ + * XML Callback to process start elements + * + * @access private + */ function _tag_open( $parser, $tag, $attributes ) { switch( strtoupper( $tag ) ) { case 'TABLE': @@ -1821,39 +1826,39 @@ class adoSchema { } /** - * XML Callback to process CDATA elements - * - * @access private - */ + * XML Callback to process CDATA elements + * + * @access private + */ function _tag_cdata( $parser, $cdata ) { } /** - * XML Callback to process end elements - * - * @access private - * @internal - */ + * XML Callback to process end elements + * + * @access private + * @internal + */ function _tag_close( $parser, $tag ) { } /** - * Converts an XML schema string to the specified DTD version. - * - * Call this method to convert a string containing an XML schema to a different AXMLS - * DTD version. For instance, to convert a schema created for an pre-1.0 version for - * AXMLS (DTD version 0.1) to a newer version of the DTD (e.g. 0.2). If no DTD version - * parameter is specified, the schema will be converted to the current DTD version. - * If the newFile parameter is provided, the converted schema will be written to the specified - * file. - * @see convertSchemaFile() - * - * @param string $schema String containing XML schema that will be converted. - * @param string $newVersion DTD version to convert to. - * @param string $newFile File name of (converted) output file. - * @return string Converted XML schema or FALSE if an error occurs. - */ + * Converts an XML schema string to the specified DTD version. + * + * Call this method to convert a string containing an XML schema to a different AXMLS + * DTD version. For instance, to convert a schema created for an pre-1.0 version for + * AXMLS (DTD version 0.1) to a newer version of the DTD (e.g. 0.2). If no DTD version + * parameter is specified, the schema will be converted to the current DTD version. + * If the newFile parameter is provided, the converted schema will be written to the specified + * file. + * @see convertSchemaFile() + * + * @param string $schema String containing XML schema that will be converted. + * @param string $newVersion DTD version to convert to. + * @param string $newFile File name of (converted) output file. + * @return string Converted XML schema or FALSE if an error occurs. + */ function convertSchemaString( $schema, $newVersion = NULL, $newFile = NULL ) { // grab current version @@ -1880,21 +1885,21 @@ class adoSchema { } /** - * Converts an XML schema file to the specified DTD version. - * - * Call this method to convert the specified XML schema file to a different AXMLS - * DTD version. For instance, to convert a schema created for an pre-1.0 version for - * AXMLS (DTD version 0.1) to a newer version of the DTD (e.g. 0.2). If no DTD version - * parameter is specified, the schema will be converted to the current DTD version. - * If the newFile parameter is provided, the converted schema will be written to the specified - * file. - * @see convertSchemaString() - * - * @param string $filename Name of XML schema file that will be converted. - * @param string $newVersion DTD version to convert to. - * @param string $newFile File name of (converted) output file. - * @return string Converted XML schema or FALSE if an error occurs. - */ + * Converts an XML schema file to the specified DTD version. + * + * Call this method to convert the specified XML schema file to a different AXMLS + * DTD version. For instance, to convert a schema created for an pre-1.0 version for + * AXMLS (DTD version 0.1) to a newer version of the DTD (e.g. 0.2). If no DTD version + * parameter is specified, the schema will be converted to the current DTD version. + * If the newFile parameter is provided, the converted schema will be written to the specified + * file. + * @see convertSchemaString() + * + * @param string $filename Name of XML schema file that will be converted. + * @param string $newVersion DTD version to convert to. + * @param string $newFile File name of (converted) output file. + * @return string Converted XML schema or FALSE if an error occurs. + */ function convertSchemaFile( $filename, $newVersion = NULL, $newFile = NULL ) { // grab current version @@ -1975,15 +1980,15 @@ class adoSchema { } /** - * Processes XSLT transformation errors - * - * @param object $parser XML parser object - * @param integer $errno Error number - * @param integer $level Error level - * @param array $fields Error information fields - * - * @access private - */ + * Processes XSLT transformation errors + * + * @param object $parser XML parser object + * @param integer $errno Error number + * @param integer $level Error level + * @param array $fields Error information fields + * + * @access private + */ function xslt_error_handler( $parser, $errno, $level, $fields ) { if( is_array( $fields ) ) { $msg = array( @@ -2028,14 +2033,14 @@ class adoSchema { } /** - * Returns the AXMLS Schema Version of the requested XML schema file. - * - * Call this method to obtain the AXMLS DTD version of the requested XML schema file. - * @see SchemaStringVersion() - * - * @param string $filename AXMLS schema file - * @return string Schema version number or FALSE on error - */ + * Returns the AXMLS Schema Version of the requested XML schema file. + * + * Call this method to obtain the AXMLS DTD version of the requested XML schema file. + * @see SchemaStringVersion() + * + * @param string $filename AXMLS schema file + * @return string Schema version number or FALSE on error + */ function schemaFileVersion( $filename ) { // Open the file if( !($fp = fopen( $filename, 'r' )) ) { @@ -2054,14 +2059,14 @@ class adoSchema { } /** - * Returns the AXMLS Schema Version of the provided XML schema string. - * - * Call this method to obtain the AXMLS DTD version of the provided XML schema string. - * @see SchemaFileVersion() - * - * @param string $xmlstring XML schema string - * @return string Schema version number or FALSE on error - */ + * Returns the AXMLS Schema Version of the provided XML schema string. + * + * Call this method to obtain the AXMLS DTD version of the provided XML schema string. + * @see SchemaFileVersion() + * + * @param string $xmlstring XML schema string + * @return string Schema version number or FALSE on error + */ function schemaStringVersion( $xmlstring ) { if( !is_string( $xmlstring ) OR empty( $xmlstring ) ) { return FALSE; @@ -2075,18 +2080,18 @@ class adoSchema { } /** - * Extracts an XML schema from an existing database. - * - * Call this method to create an XML schema string from an existing database. - * If the data parameter is set to TRUE, AXMLS will include the data from the database - * tables in the schema. - * - * @param boolean $data include data in schema dump - * @param string $indent indentation to use - * @param string $prefix extract only tables with given prefix - * @param boolean $stripprefix strip prefix string when storing in XML schema - * @return string Generated XML schema - */ + * Extracts an XML schema from an existing database. + * + * Call this method to create an XML schema string from an existing database. + * If the data parameter is set to TRUE, AXMLS will include the data from the database + * tables in the schema. + * + * @param boolean $data include data in schema dump + * @param string $indent indentation to use + * @param string $prefix extract only tables with given prefix + * @param boolean $stripprefix strip prefix string when storing in XML schema + * @return string Generated XML schema + */ function extractSchema( $data = FALSE, $indent = ' ', $prefix = '' , $stripprefix=false) { $old_mode = $this->db->setFetchMode( ADODB_FETCH_NUM ); @@ -2195,15 +2200,15 @@ class adoSchema { } /** - * Sets a prefix for database objects - * - * Call this method to set a standard prefix that will be prepended to all database tables - * and indices when the schema is parsed. Calling setPrefix with no arguments clears the prefix. - * - * @param string $prefix Prefix that will be prepended. - * @param boolean $underscore If TRUE, automatically append an underscore character to the prefix. - * @return boolean TRUE if successful, else FALSE - */ + * Sets a prefix for database objects + * + * Call this method to set a standard prefix that will be prepended to all database tables + * and indices when the schema is parsed. Calling setPrefix with no arguments clears the prefix. + * + * @param string $prefix Prefix that will be prepended. + * @param boolean $underscore If TRUE, automatically append an underscore character to the prefix. + * @return boolean TRUE if successful, else FALSE + */ function setPrefix( $prefix = '', $underscore = TRUE ) { switch( TRUE ) { // clear prefix @@ -2230,13 +2235,13 @@ class adoSchema { } /** - * Returns an object name with the current prefix prepended. - * - * @param string $name Name - * @return string Prefixed name - * - * @access private - */ + * Returns an object name with the current prefix prepended. + * + * @param string $name Name + * @return string Prefixed name + * + * @access private + */ function prefix( $name = '' ) { // if prefix is set if( !empty( $this->objectPrefix ) ) { @@ -2250,13 +2255,13 @@ class adoSchema { } /** - * Checks if element references a specific platform - * - * @param string $platform Requested platform - * @returns boolean TRUE if platform check succeeds - * - * @access private - */ + * Checks if element references a specific platform + * + * @param string $platform Requested platform + * @returns boolean TRUE if platform check succeeds + * + * @access private + */ function supportedPlatform( $platform = NULL ) { if( !empty( $platform ) ) { $regex = '/(^|\|)' . $this->db->databaseType . '(\||$)/i'; @@ -2279,22 +2284,22 @@ class adoSchema { } /** - * Clears the array of generated SQL. - * - * @access private - */ + * Clears the array of generated SQL. + * + * @access private + */ function clearSQL() { $this->sqlArray = array(); } /** - * Adds SQL into the SQL array. - * - * @param mixed $sql SQL to Add - * @return boolean TRUE if successful, else FALSE. - * - * @access private - */ + * Adds SQL into the SQL array. + * + * @param mixed $sql SQL to Add + * @return boolean TRUE if successful, else FALSE. + * + * @access private + */ function addSQL( $sql = NULL ) { if( is_array( $sql ) ) { foreach( $sql as $line ) { @@ -2330,13 +2335,13 @@ class adoSchema { } /** - * Gets the SQL array in the specified format. - * - * @param string $format Format - * @return mixed SQL - * - * @access private - */ + * Gets the SQL array in the specified format. + * + * @param string $format Format + * @return mixed SQL + * + * @access private + */ function getSQL( $format = NULL, $sqlArray = NULL ) { if( !is_array( $sqlArray ) ) { $sqlArray = $this->sqlArray; @@ -2358,20 +2363,20 @@ class adoSchema { } /** - * Destroys an adoSchema object. - * - * Call this method to clean up after an adoSchema object that is no longer in use. - * @deprecated adoSchema now cleans up automatically. - */ + * Destroys an adoSchema object. + * + * Call this method to clean up after an adoSchema object that is no longer in use. + * @deprecated adoSchema now cleans up automatically. + */ function destroy() { } } /** -* Message logging function -* -* @access private -*/ + * Message logging function + * + * @access private + */ function logMsg( $msg, $title = NULL, $force = FALSE ) { if( XMLS_DEBUG or $force ) { echo '<pre>'; |
