Child classes:
Inherited Variables
Inherited Methods
Class Details
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.
Tags:
- Package - default
- Copyright - (c) 2003 ars Cognita, Inc., all rights reserved
- Version - $Revision: 1.3 $
- Author - Richard Tango-Lowy
[ Top ]
Class Variables
$sqlArray =
Tags:
- Var - Array containing SQL queries to generate all objects
Type: array
Overrides:
[ Top ]
Class Methods
constructor adoSchema
void constructor adoSchema ( $dbconn, [$upgradeSchema = FALSE], [$forceReplace = FALSE] )
Constructor. Initializes the xmlschema object.
adoSchema provides methods to parse and process the XML schema file. The dbconn argument
is a database connection object created by ADONewConnection. To upgrade an existing database to
the provided schema, set the upgradeSchema flag to TRUE. By default, adoSchema will attempt to
upgrade tables by ALTERing them on the fly. If your RDBMS doesn't support direct alteration
(e.g., PostgreSQL), setting the forceReplace flag to TRUE will replace existing tables rather than
altering them, copying data from each column in the old table to the like-named column in the
new table.
Tags:
Parameters:
- object $dbconn - ADOdb connection object
- object $upgradeSchema - Upgrade the database (deprecated)
- object $forceReplace - If upgrading, REPLACE tables (deprecated)
[ Top ]
Destroy
void Destroy ( )
Destructor: Destroys an adoSchema object.
You should call this to clean up when you're finished with adoSchema.
Tags:
Parameters:
[ Top ]
ExecuteSchema
void ExecuteSchema ( $sqlArray, [$continueOnErr = TRUE] )
Loads a schema into the database
Accepts an array of SQL queries generated by the parser
and executes them.
Tags:
- Returns - integer 0 if failed, 1 if errors, 2 if successful
Parameters:
- array $sqlArray - Array of SQL statements
- boolean $continueOnErr - Don't fail out if an error is encountered
[ Top ]
ParseSchema
array ParseSchema ( $file )
Loads and parses an XML file
This method accepts a path to an xmlschema-compliant XML file,
loads it, parses it, and uses it to create the SQL to generate the objects
described by the XML file.
Tags:
- Return - Array of SQL queries, ready to execute
Parameters:
- string $file - XML file
[ Top ]
setPrefix
boolean setPrefix ( [$prefix = ''] )
Set object prefix
Sets a standard prefix that will be prepended to all database tables during
database creation. Calling setPrefix with no arguments clears the prefix.
Tags:
- Return - TRUE if successful, else FALSE
Parameters:
- string $prefix - Prefix
[ Top ]
upgradeSchema
void upgradeSchema ( [$method = 'BEST'] )
Upgrades an existing schema rather than creating a new one
Upgrades an exsiting database to match the provided schema. 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.
Tags:
- Returns - string Upgrade method used
Parameters:
- string $method - Upgrade method (ALTER|REPLACE|BEST|NONE)
[ Top ]