Class adoSchema
adoSchema
Classes extended from adoSchema: ^TOP
Located in File: Program_Root/adodb-xmlschema.inc.php
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.
Inherited Class Variable Summary
^TOP
|
Inherited Method Summary
^TOP
|
$sqlArray
Data type: array
- Var -
Array containing SQL queries to generate all objects
constructor adoSchema
Useage :
void
constructor adoSchema ( $dbconn, [$upgradeSchema = FALSE], [$forceReplace = FALSE] )
Description :
Initializes the xmlschema object.
adoSchema provides methods to parse and process the XML schema file, and is called automatically
when an xmlschema object is instantiated.
The dbconn argument is a database connection object created by ADONewConnection.
Set upgradeSchema to TRUE to upgrade an existing database to the provided schema. By default,
adoSchema will attempt to upgrade tables by ALTERing them on the fly. Upgrading has only been tested
on the MySQL platform. It is know NOT to work on PostgreSQL. The forceReplace flag is not currently
implemented.
- Function Parameters:
- - object $dbconn ADOdb connection object
- - object $upgradeSchema Upgrade the database
- - object $forceReplace If upgrading, REPLACE tables (**NOT IMPLEMENTED**)
- Function Info:
Destroy
Useage :
void
Destroy ( )
Description :
Destroys the current object, freeing all bound resources
It is recommended that you explicitly destroy all adoSchema objects when
you are finished using them.
- Function Parameters:
- Function Info:
ExecuteSchema
Useage :
integer
ExecuteSchema ( $sqlArray, [$continueOnErr = TRUE] )
Description :
Loads a schema into the database
Accepts an array of SQL queries generated by the parser
and executes them.
- Function Parameters:
- - array $sqlArray Array of SQL statements
- - boolean $continueOnErr Don't fail out if an error is encountered
- Function Info:
- Return - 0 if failed, 1 if errors, 2 if successful
ParseSchema
Useage :
array
ParseSchema ( $file )
Description :
Loads and XML document and parses it into a prepared schema
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.
- Function Parameters:
- - string $file XML file
- Function Info:
- Return - Array of SQL queries, ready to execute
setPrefix
Useage :
boolean
setPrefix ( [$prefix = ''] )
Description :
Sets default table prefix
Sets a standard prefix that will be prepended to all database tables during
database creation. The prefix will automatically apply to tables referenced in indices as well.
Calling setPrefix with no arguments clears the prefix.
- Function Parameters:
- - string $prefix Prefix
- Function Info:
- Return - TRUE if successful, else FALSE