|
Adodb Dokumentation
V5.14 8 Sept 2011
|
Öffentliche Methoden | |
| adoSchema ($db) | |
| SetUpgradeMethod ($method= '') | |
| ExecuteInline ($mode=NULL) | |
| ContinueOnError ($mode=NULL) | |
| ParseSchema ($filename, $returnSchema=FALSE) | |
| ParseSchemaFile ($filename, $returnSchema=FALSE) | |
| ParseSchemaString ($xmlstring, $returnSchema=FALSE) | |
| RemoveSchema ($filename, $returnSchema=FALSE) | |
| RemoveSchemaString ($schema, $returnSchema=FALSE) | |
| ExecuteSchema ($sqlArray=NULL, $continueOnErr=NULL) | |
| PrintSQL ($format= 'NONE') | |
| SaveSQL ($filename= './schema.sql') | |
| create_parser () | |
| _tag_open (&$parser, $tag, $attributes) | |
| _tag_cdata (&$parser, $cdata) | |
| _tag_close (&$parser, $tag) | |
| ConvertSchemaString ($schema, $newVersion=NULL, $newFile=NULL) | |
| _file_get_contents ($path) | |
| ConvertSchemaFile ($filename, $newVersion=NULL, $newFile=NULL) | |
| TransformSchema ($schema, $xsl, $schematype='string') | |
| xslt_error_handler ($parser, $errno, $level, $fields) | |
| SchemaFileVersion ($filename) | |
| SchemaStringVersion ($xmlstring) | |
| ExtractSchema ($data=FALSE) | |
| SetPrefix ($prefix= '', $underscore=TRUE) | |
| prefix ($name= '') | |
| supportedPlatform ($platform=NULL) | |
| clearSQL () | |
| addSQL ($sql=NULL) | |
| getSQL ($format=NULL, $sqlArray=NULL) | |
| Destroy () | |
| adoSchema ($db) | |
| SetUpgradeMethod ($method= '') | |
| ExistingData ($mode=NULL) | |
| ExecuteInline ($mode=NULL) | |
| ContinueOnError ($mode=NULL) | |
| ParseSchema ($filename, $returnSchema=FALSE) | |
| ParseSchemaFile ($filename, $returnSchema=FALSE) | |
| ParseSchemaString ($xmlstring, $returnSchema=FALSE) | |
| RemoveSchema ($filename, $returnSchema=FALSE) | |
| RemoveSchemaString ($schema, $returnSchema=FALSE) | |
| ExecuteSchema ($sqlArray=NULL, $continueOnErr=NULL) | |
| PrintSQL ($format= 'NONE') | |
| SaveSQL ($filename= './schema.sql') | |
| create_parser () | |
| _tag_open (&$parser, $tag, $attributes) | |
| _tag_cdata (&$parser, $cdata) | |
| _tag_close (&$parser, $tag) | |
| ConvertSchemaString ($schema, $newVersion=NULL, $newFile=NULL) | |
| ConvertSchemaFile ($filename, $newVersion=NULL, $newFile=NULL) | |
| TransformSchema ($schema, $xsl, $schematype='string') | |
| xslt_error_handler ($parser, $errno, $level, $fields) | |
| SchemaFileVersion ($filename) | |
| SchemaStringVersion ($xmlstring) | |
| ExtractSchema ($data=FALSE, $indent= ' ', $prefix= '', $stripprefix=false) | |
| SetPrefix ($prefix= '', $underscore=TRUE) | |
| prefix ($name= '') | |
| supportedPlatform ($platform=NULL) | |
| clearSQL () | |
| addSQL ($sql=NULL) | |
| getSQL ($format=NULL, $sqlArray=NULL) | |
| Destroy () | |
Datenfelder | |
| $sqlArray | |
| $db | |
| $dict | |
| $currentElement = '' | |
| $upgrade = '' | |
| $objectPrefix = '' | |
| $mgq | |
| $debug | |
| $versionRegex = '/<schema.*?( version="([^"]*)")?.*?>/' | |
| $schemaVersion | |
| $success | |
| $executeInline | |
| $continueOnError | |
| $existingData | |
Definiert in Zeile 1218 der Datei adodb-xmlschema.inc.php.
| _tag_cdata | ( | &$ | parser, |
| $ | cdata | ||
| ) |
XML Callback to process CDATA elements
private
Definiert in Zeile 1673 der Datei adodb-xmlschema.inc.php.
{
}
| _tag_cdata | ( | &$ | parser, |
| $ | cdata | ||
| ) |
XML Callback to process CDATA elements
private
Definiert in Zeile 1832 der Datei adodb-xmlschema03.inc.php.
{
}
| _tag_close | ( | &$ | parser, |
| $ | tag | ||
| ) |
XML Callback to process end elements
private
Definiert in Zeile 1682 der Datei adodb-xmlschema.inc.php.
{
}
| _tag_close | ( | &$ | parser, |
| $ | tag | ||
| ) |
XML Callback to process end elements
private
Definiert in Zeile 1841 der Datei adodb-xmlschema03.inc.php.
{
}
| _tag_open | ( | &$ | parser, |
| $ | tag, | ||
| $ | attributes | ||
| ) |
XML Callback to process start elements
private
Definiert in Zeile 1650 der Datei adodb-xmlschema.inc.php.
{
switch( strtoupper( $tag ) ) {
case 'TABLE':
$this->obj = new dbTable( $this, $attributes );
xml_set_object( $parser, $this->obj );
break;
case 'SQL':
if( !isset( $attributes['PLATFORM'] ) OR $this->supportedPlatform( $attributes['PLATFORM'] ) ) {
$this->obj = new dbQuerySet( $this, $attributes );
xml_set_object( $parser, $this->obj );
}
break;
default:
// print_r( array( $tag, $attributes ) );
}
}

| _tag_open | ( | &$ | parser, |
| $ | tag, | ||
| $ | attributes | ||
| ) |
XML Callback to process start elements
private
Definiert in Zeile 1807 der Datei adodb-xmlschema03.inc.php.
{
switch( strtoupper( $tag ) ) {
case 'TABLE':
if( !isset( $attributes['PLATFORM'] ) OR $this->supportedPlatform( $attributes['PLATFORM'] ) ) {
$this->obj = new dbTable( $this, $attributes );
xml_set_object( $parser, $this->obj );
}
break;
case 'SQL':
if( !isset( $attributes['PLATFORM'] ) OR $this->supportedPlatform( $attributes['PLATFORM'] ) ) {
$this->obj = new dbQuerySet( $this, $attributes );
xml_set_object( $parser, $this->obj );
}
break;
default:
// print_r( array( $tag, $attributes ) );
}
}

| addSQL | ( | $ | sql = NULL | ) |
Adds SQL into the SQL array.
| mixed | $sql | SQL to Add |
private
Definiert in Zeile 2128 der Datei adodb-xmlschema.inc.php.
{
if( is_array( $sql ) ) {
foreach( $sql as $line ) {
$this->addSQL( $line );
}
return TRUE;
}
if( is_string( $sql ) ) {
$this->sqlArray[] = $sql;
// if executeInline is enabled, and either no errors have occurred or continueOnError is enabled, execute SQL.
if( $this->ExecuteInline() && ( $this->success == 2 || $this->ContinueOnError() ) ) {
$saved = $this->db->debug;
$this->db->debug = $this->debug;
$ok = $this->db->Execute( $sql );
$this->db->debug = $saved;
if( !$ok ) {
if( $this->debug ) {
ADOConnection::outp( $this->db->ErrorMsg() );
}
$this->success = 1;
}
}
return TRUE;
}
return FALSE;
}


| addSQL | ( | $ | sql = NULL | ) |
Adds SQL into the SQL array.
| mixed | $sql | SQL to Add |
private
Definiert in Zeile 2309 der Datei adodb-xmlschema03.inc.php.
{
if( is_array( $sql ) ) {
foreach( $sql as $line ) {
$this->addSQL( $line );
}
return TRUE;
}
if( is_string( $sql ) ) {
$this->sqlArray[] = $sql;
// if executeInline is enabled, and either no errors have occurred or continueOnError is enabled, execute SQL.
if( $this->ExecuteInline() && ( $this->success == 2 || $this->ContinueOnError() ) ) {
$saved = $this->db->debug;
$this->db->debug = $this->debug;
$ok = $this->db->Execute( $sql );
$this->db->debug = $saved;
if( !$ok ) {
if( $this->debug ) {
ADOConnection::outp( $this->db->ErrorMsg() );
}
$this->success = 1;
}
}
return TRUE;
}
return FALSE;
}

| adoSchema | ( | $ | db | ) |
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.
| object | $db | ADOdb database connection object. |
Definiert in Zeile 1304 der Datei adodb-xmlschema.inc.php.
{
// Initialize the environment
$this->mgq = get_magic_quotes_runtime();
ini_set("magic_quotes_runtime", 0);
#set_magic_quotes_runtime(0);
$this->db = $db;
$this->debug = $this->db->debug;
$this->dict = NewDataDictionary( $this->db );
$this->sqlArray = array();
$this->schemaVersion = XMLS_SCHEMA_VERSION;
$this->executeInline( XMLS_EXECUTE_INLINE );
$this->continueOnError( XMLS_CONTINUE_ON_ERROR );
$this->setUpgradeMethod();
}
| adoSchema | ( | $ | db | ) |
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.
| object | $db | ADOdb database connection object. |
Definiert in Zeile 1408 der Datei adodb-xmlschema03.inc.php.
{
// Initialize the environment
$this->mgq = get_magic_quotes_runtime();
#set_magic_quotes_runtime(0);
ini_set("magic_quotes_runtime", 0);
$this->db = $db;
$this->debug = $this->db->debug;
$this->dict = NewDataDictionary( $this->db );
$this->sqlArray = array();
$this->schemaVersion = XMLS_SCHEMA_VERSION;
$this->executeInline( XMLS_EXECUTE_INLINE );
$this->continueOnError( XMLS_CONTINUE_ON_ERROR );
$this->existingData( XMLS_EXISTING_DATA );
$this->setUpgradeMethod();
}
| clearSQL | ( | ) |
Clears the array of generated SQL.
private
Definiert in Zeile 2116 der Datei adodb-xmlschema.inc.php.
{
$this->sqlArray = array();
}
| clearSQL | ( | ) |
Clears the array of generated SQL.
private
Definiert in Zeile 2297 der Datei adodb-xmlschema03.inc.php.
{
$this->sqlArray = array();
}
| ContinueOnError | ( | $ | mode = NULL | ) |
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.
| bool | $mode | execute |
Definiert in Zeile 1399 der Datei adodb-xmlschema.inc.php.
{
if( is_bool( $mode ) ) {
$this->continueOnError = $mode;
}
return $this->continueOnError;
}

| ContinueOnError | ( | $ | mode = NULL | ) |
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.
| bool | $mode | execute |
Definiert in Zeile 1545 der Datei adodb-xmlschema03.inc.php.
{
if( is_bool( $mode ) ) {
$this->continueOnError = $mode;
}
return $this->continueOnError;
}
| ConvertSchemaFile | ( | $ | filename, |
| $ | newVersion = NULL, |
||
| $ | newFile = NULL |
||
| ) |
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.
| string | $filename | Name of XML schema file that will be converted. |
| string | $newVersion | DTD version to convert to. |
| string | $newFile | File name of (converted) output file. |
Definiert in Zeile 1750 der Datei adodb-xmlschema.inc.php.
{
// grab current version
if( !( $version = $this->SchemaFileVersion( $filename ) ) ) {
return FALSE;
}
if( !isset ($newVersion) ) {
$newVersion = $this->schemaVersion;
}
if( $version == $newVersion ) {
$result = _file_get_contents( $filename );
// remove unicode BOM if present
if( substr( $result, 0, 3 ) == sprintf( '%c%c%c', 239, 187, 191 ) ) {
$result = substr( $result, 3 );
}
} else {
$result = $this->TransformSchema( $filename, 'convert-' . $version . '-' . $newVersion, 'file' );
}
if( is_string( $result ) AND is_string( $newFile ) AND ( $fp = fopen( $newFile, 'w' ) ) ) {
fwrite( $fp, $result );
fclose( $fp );
}
return $result;
}


| ConvertSchemaFile | ( | $ | filename, |
| $ | newVersion = NULL, |
||
| $ | newFile = NULL |
||
| ) |
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.
| string | $filename | Name of XML schema file that will be converted. |
| string | $newVersion | DTD version to convert to. |
| string | $newFile | File name of (converted) output file. |
Definiert in Zeile 1910 der Datei adodb-xmlschema03.inc.php.
{
// grab current version
if( !( $version = $this->SchemaFileVersion( $filename ) ) ) {
return FALSE;
}
if( !isset ($newVersion) ) {
$newVersion = $this->schemaVersion;
}
if( $version == $newVersion ) {
$result = _file_get_contents( $filename );
// remove unicode BOM if present
if( substr( $result, 0, 3 ) == sprintf( '%c%c%c', 239, 187, 191 ) ) {
$result = substr( $result, 3 );
}
} else {
$result = $this->TransformSchema( $filename, 'convert-' . $version . '-' . $newVersion, 'file' );
}
if( is_string( $result ) AND is_string( $newFile ) AND ( $fp = fopen( $newFile, 'w' ) ) ) {
fwrite( $fp, $result );
fclose( $fp );
}
return $result;
}

| ConvertSchemaString | ( | $ | schema, |
| $ | newVersion = NULL, |
||
| $ | newFile = NULL |
||
| ) |
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.
| string | $schema | String containing XML schema that will be converted. |
| string | $newVersion | DTD version to convert to. |
| string | $newFile | File name of (converted) output file. |
Definiert in Zeile 1702 der Datei adodb-xmlschema.inc.php.
{
// grab current version
if( !( $version = $this->SchemaStringVersion( $schema ) ) ) {
return FALSE;
}
if( !isset ($newVersion) ) {
$newVersion = $this->schemaVersion;
}
if( $version == $newVersion ) {
$result = $schema;
} else {
$result = $this->TransformSchema( $schema, 'convert-' . $version . '-' . $newVersion);
}
if( is_string( $result ) AND is_string( $newFile ) AND ( $fp = fopen( $newFile, 'w' ) ) ) {
fwrite( $fp, $result );
fclose( $fp );
}
return $result;
}

| ConvertSchemaString | ( | $ | schema, |
| $ | newVersion = NULL, |
||
| $ | newFile = NULL |
||
| ) |
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.
| string | $schema | String containing XML schema that will be converted. |
| string | $newVersion | DTD version to convert to. |
| string | $newFile | File name of (converted) output file. |
Definiert in Zeile 1861 der Datei adodb-xmlschema03.inc.php.
{
// grab current version
if( !( $version = $this->SchemaStringVersion( $schema ) ) ) {
return FALSE;
}
if( !isset ($newVersion) ) {
$newVersion = $this->schemaVersion;
}
if( $version == $newVersion ) {
$result = $schema;
} else {
$result = $this->TransformSchema( $schema, 'convert-' . $version . '-' . $newVersion);
}
if( is_string( $result ) AND is_string( $newFile ) AND ( $fp = fopen( $newFile, 'w' ) ) ) {
fwrite( $fp, $result );
fclose( $fp );
}
return $result;
}

| create_parser | ( | ) |
Create an xml parser
private
Definiert in Zeile 1633 der Datei adodb-xmlschema.inc.php.
{
// Create the parser
$xmlParser = xml_parser_create();
xml_set_object( $xmlParser, $this );
// Initialize the XML callback functions
xml_set_element_handler( $xmlParser, '_tag_open', '_tag_close' );
xml_set_character_data_handler( $xmlParser, '_tag_cdata' );
return $xmlParser;
}

| create_parser | ( | ) |
Create an xml parser
private
Definiert in Zeile 1790 der Datei adodb-xmlschema03.inc.php.
{
// Create the parser
$xmlParser = xml_parser_create();
xml_set_object( $xmlParser, $this );
// Initialize the XML callback functions
xml_set_element_handler( $xmlParser, '_tag_open', '_tag_close' );
xml_set_character_data_handler( $xmlParser, '_tag_cdata' );
return $xmlParser;
}
| Destroy | ( | ) |
Destroys an adoSchema object.
Call this method to clean up after an adoSchema object that is no longer in use.
Definiert in Zeile 2196 der Datei adodb-xmlschema.inc.php.
{
ini_set("magic_quotes_runtime", $this->mgq );
#set_magic_quotes_runtime( $this->mgq );
unset( $this );
}
| Destroy | ( | ) |
Destroys an adoSchema object.
Call this method to clean up after an adoSchema object that is no longer in use.
Definiert in Zeile 2377 der Datei adodb-xmlschema03.inc.php.
{
ini_set("magic_quotes_runtime", $this->mgq );
#set_magic_quotes_runtime( $this->mgq );
unset( $this );
}
| ExecuteInline | ( | $ | mode = NULL | ) |
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.
| bool | $mode | execute |
Definiert in Zeile 1378 der Datei adodb-xmlschema.inc.php.
{
if( is_bool( $mode ) ) {
$this->executeInline = $mode;
}
return $this->executeInline;
}

| ExecuteInline | ( | $ | mode = NULL | ) |
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.
| bool | $mode | execute |
Definiert in Zeile 1524 der Datei adodb-xmlschema03.inc.php.
{
if( is_bool( $mode ) ) {
$this->executeInline = $mode;
}
return $this->executeInline;
}
| ExecuteSchema | ( | $ | sqlArray = NULL, |
| $ | continueOnErr = NULL |
||
| ) |
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.
| array | $sqlArray | Array of SQL statements that will be applied rather than the current schema. |
| boolean | $continueOnErr | Continue to apply the schema even if an error occurs. |
Definiert in Zeile 1568 der Datei adodb-xmlschema.inc.php.
{
if( !is_bool( $continueOnErr ) ) {
$continueOnErr = $this->ContinueOnError();
}
if( !isset( $sqlArray ) ) {
$sqlArray = $this->sqlArray;
}
if( !is_array( $sqlArray ) ) {
$this->success = 0;
} else {
$this->success = $this->dict->ExecuteSQLArray( $sqlArray, $continueOnErr );
}
return $this->success;
}

| ExecuteSchema | ( | $ | sqlArray = NULL, |
| $ | continueOnErr = NULL |
||
| ) |
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.
| array | $sqlArray | Array of SQL statements that will be applied rather than the current schema. |
| boolean | $continueOnErr | Continue to apply the schema even if an error occurs. |
Definiert in Zeile 1725 der Datei adodb-xmlschema03.inc.php.
{
if( !is_bool( $continueOnErr ) ) {
$continueOnErr = $this->ContinueOnError();
}
if( !isset( $sqlArray ) ) {
$sqlArray = $this->sqlArray;
}
if( !is_array( $sqlArray ) ) {
$this->success = 0;
} else {
$this->success = $this->dict->ExecuteSQLArray( $sqlArray, $continueOnErr );
}
return $this->success;
}

| ExistingData | ( | $ | mode = NULL | ) |
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.
| int | $mode | XMLS_MODE_INSERT, XMLS_MODE_UPDATE, or XMLS_MODE_IGNORE |
Definiert in Zeile 1489 der Datei adodb-xmlschema03.inc.php.
{
if( is_int( $mode ) ) {
switch( $mode ) {
case XMLS_MODE_UPDATE:
$mode = XMLS_MODE_UPDATE;
break;
case XMLS_MODE_IGNORE:
$mode = XMLS_MODE_IGNORE;
break;
case XMLS_MODE_INSERT:
$mode = XMLS_MODE_INSERT;
break;
default:
$mode = XMLS_EXISTING_DATA;
break;
}
$this->existingData = $mode;
}
return $this->existingData;
}
| ExtractSchema | ( | $ | data = FALSE | ) |
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 in the schema.
| boolean | $data | Include data in schema dump |
Definiert in Zeile 1939 der Datei adodb-xmlschema.inc.php.
{
$old_mode = $this->db->SetFetchMode( ADODB_FETCH_NUM );
$schema = '<?xml version="1.0"?>' . "\n"
. '<schema version="' . $this->schemaVersion . '">' . "\n";
if( is_array( $tables = $this->db->MetaTables( 'TABLES' ) ) ) {
foreach( $tables as $table ) {
$schema .= ' <table name="' . $table . '">' . "\n";
// grab details from database
$rs = $this->db->Execute( 'SELECT * FROM ' . $table . ' WHERE 1=1' );
$fields = $this->db->MetaColumns( $table );
$indexes = $this->db->MetaIndexes( $table );
if( is_array( $fields ) ) {
foreach( $fields as $details ) {
$extra = '';
$content = array();
if( $details->max_length > 0 ) {
$extra .= ' size="' . $details->max_length . '"';
}
if( $details->primary_key ) {
$content[] = '<KEY/>';
} elseif( $details->not_null ) {
$content[] = '<NOTNULL/>';
}
if( $details->has_default ) {
$content[] = '<DEFAULT value="' . $details->default_value . '"/>';
}
if( $details->auto_increment ) {
$content[] = '<AUTOINCREMENT/>';
}
// this stops the creation of 'R' columns,
// AUTOINCREMENT is used to create auto columns
$details->primary_key = 0;
$type = $rs->MetaType( $details );
$schema .= ' <field name="' . $details->name . '" type="' . $type . '"' . $extra . '>';
if( !empty( $content ) ) {
$schema .= "\n " . implode( "\n ", $content ) . "\n ";
}
$schema .= '</field>' . "\n";
}
}
if( is_array( $indexes ) ) {
foreach( $indexes as $index => $details ) {
$schema .= ' <index name="' . $index . '">' . "\n";
if( $details['unique'] ) {
$schema .= ' <UNIQUE/>' . "\n";
}
foreach( $details['columns'] as $column ) {
$schema .= ' <col>' . $column . '</col>' . "\n";
}
$schema .= ' </index>' . "\n";
}
}
if( $data ) {
$rs = $this->db->Execute( 'SELECT * FROM ' . $table );
if( is_object( $rs ) ) {
$schema .= ' <data>' . "\n";
while( $row = $rs->FetchRow() ) {
foreach( $row as $key => $val ) {
$row[$key] = htmlentities($val);
}
$schema .= ' <row><f>' . implode( '</f><f>', $row ) . '</f></row>' . "\n";
}
$schema .= ' </data>' . "\n";
}
}
$schema .= ' </table>' . "\n";
}
}
$this->db->SetFetchMode( $old_mode );
$schema .= '</schema>';
return $schema;
}
| ExtractSchema | ( | $ | data = FALSE, |
| $ | indent = ' ', |
||
| $ | prefix = '', |
||
| $ | stripprefix = false |
||
| ) |
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 in the schema.
| boolean | $data | Include data in schema dump string indentation to use string extract only tables with given prefix strip prefix string when storing in XML schema |
Definiert in Zeile 2102 der Datei adodb-xmlschema03.inc.php.
{
$old_mode = $this->db->SetFetchMode( ADODB_FETCH_NUM );
$schema = '<?xml version="1.0"?>' . "\n"
. '<schema version="' . $this->schemaVersion . '">' . "\n";
if( is_array( $tables = $this->db->MetaTables( 'TABLES' , ($prefix) ? $prefix.'%' : '') ) ) {
foreach( $tables as $table ) {
if ($stripprefix) $table = str_replace(str_replace('\\_', '_', $pfx ), '', $table);
$schema .= $indent . '<table name="' . htmlentities( $table ) . '">' . "\n";
// grab details from database
$rs = $this->db->Execute( 'SELECT * FROM ' . $table . ' WHERE -1' );
$fields = $this->db->MetaColumns( $table );
$indexes = $this->db->MetaIndexes( $table );
if( is_array( $fields ) ) {
foreach( $fields as $details ) {
$extra = '';
$content = array();
if( isset($details->max_length) && $details->max_length > 0 ) {
$extra .= ' size="' . $details->max_length . '"';
}
if( isset($details->primary_key) && $details->primary_key ) {
$content[] = '<KEY/>';
} elseif( isset($details->not_null) && $details->not_null ) {
$content[] = '<NOTNULL/>';
}
if( isset($details->has_default) && $details->has_default ) {
$content[] = '<DEFAULT value="' . htmlentities( $details->default_value ) . '"/>';
}
if( isset($details->auto_increment) && $details->auto_increment ) {
$content[] = '<AUTOINCREMENT/>';
}
if( isset($details->unsigned) && $details->unsigned ) {
$content[] = '<UNSIGNED/>';
}
// this stops the creation of 'R' columns,
// AUTOINCREMENT is used to create auto columns
$details->primary_key = 0;
$type = $rs->MetaType( $details );
$schema .= str_repeat( $indent, 2 ) . '<field name="' . htmlentities( $details->name ) . '" type="' . $type . '"' . $extra;
if( !empty( $content ) ) {
$schema .= ">\n" . str_repeat( $indent, 3 )
. implode( "\n" . str_repeat( $indent, 3 ), $content ) . "\n"
. str_repeat( $indent, 2 ) . '</field>' . "\n";
} else {
$schema .= "/>\n";
}
}
}
if( is_array( $indexes ) ) {
foreach( $indexes as $index => $details ) {
$schema .= str_repeat( $indent, 2 ) . '<index name="' . $index . '">' . "\n";
if( $details['unique'] ) {
$schema .= str_repeat( $indent, 3 ) . '<UNIQUE/>' . "\n";
}
foreach( $details['columns'] as $column ) {
$schema .= str_repeat( $indent, 3 ) . '<col>' . htmlentities( $column ) . '</col>' . "\n";
}
$schema .= str_repeat( $indent, 2 ) . '</index>' . "\n";
}
}
if( $data ) {
$rs = $this->db->Execute( 'SELECT * FROM ' . $table );
if( is_object( $rs ) && !$rs->EOF ) {
$schema .= str_repeat( $indent, 2 ) . "<data>\n";
while( $row = $rs->FetchRow() ) {
foreach( $row as $key => $val ) {
if ( $val != htmlentities( $val ) ) {
$row[$key] = '<![CDATA[' . $val . ']]>';
}
}
$schema .= str_repeat( $indent, 3 ) . '<row><f>' . implode( '</f><f>', $row ) . "</f></row>\n";
}
$schema .= str_repeat( $indent, 2 ) . "</data>\n";
}
}
$schema .= $indent . "</table>\n";
}
}
$this->db->SetFetchMode( $old_mode );
$schema .= '</schema>';
return $schema;
}
| getSQL | ( | $ | format = NULL, |
| $ | sqlArray = NULL |
||
| ) |
Gets the SQL array in the specified format.
| string | $format | Format |
private
Definiert in Zeile 2170 der Datei adodb-xmlschema.inc.php.
{
if( !is_array( $sqlArray ) ) {
$sqlArray = $this->sqlArray;
}
if( !is_array( $sqlArray ) ) {
return FALSE;
}
switch( strtolower( $format ) ) {
case 'string':
case 'text':
return !empty( $sqlArray ) ? implode( ";\n\n", $sqlArray ) . ';' : '';
case'html':
return !empty( $sqlArray ) ? nl2br( htmlentities( implode( ";\n\n", $sqlArray ) . ';' ) ) : '';
}
return $this->sqlArray;
}

| getSQL | ( | $ | format = NULL, |
| $ | sqlArray = NULL |
||
| ) |
Gets the SQL array in the specified format.
| string | $format | Format |
private
Definiert in Zeile 2351 der Datei adodb-xmlschema03.inc.php.
{
if( !is_array( $sqlArray ) ) {
$sqlArray = $this->sqlArray;
}
if( !is_array( $sqlArray ) ) {
return FALSE;
}
switch( strtolower( $format ) ) {
case 'string':
case 'text':
return !empty( $sqlArray ) ? implode( ";\n\n", $sqlArray ) . ';' : '';
case'html':
return !empty( $sqlArray ) ? nl2br( htmlentities( implode( ";\n\n", $sqlArray ) . ';' ) ) : '';
}
return $this->sqlArray;
}
| ParseSchema | ( | $ | filename, |
| $ | returnSchema = FALSE |
||
| ) |
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.
| string | $file | Name of XML schema file. |
| bool | $returnSchema | Return schema rather than parsing. |
Definiert in Zeile 1418 der Datei adodb-xmlschema.inc.php.
{
return $this->ParseSchemaString( $this->ConvertSchemaFile( $filename ), $returnSchema );
}

| ParseSchema | ( | $ | filename, |
| $ | returnSchema = FALSE |
||
| ) |
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.
| string | $file | Name of XML schema file. |
| bool | $returnSchema | Return schema rather than parsing. |
Definiert in Zeile 1566 der Datei adodb-xmlschema03.inc.php.
{
return $this->ParseSchemaString( $this->ConvertSchemaFile( $filename ), $returnSchema );
}

| ParseSchemaFile | ( | $ | filename, |
| $ | returnSchema = FALSE |
||
| ) |
Loads an XML schema from a file and converts it to SQL.
Call this method to load the specified schema from a file (see the DTD for the proper format) and generate the SQL necessary to create the database described by the schema.
| string | $file | Name of XML schema file. |
| bool | $returnSchema | Return schema rather than parsing. |
Definiert in Zeile 1435 der Datei adodb-xmlschema.inc.php.
{
// Open the file
if( !($fp = fopen( $filename, 'r' )) ) {
// die( 'Unable to open file' );
return FALSE;
}
// do version detection here
if( $this->SchemaFileVersion( $filename ) != $this->schemaVersion ) {
return FALSE;
}
if ( $returnSchema )
{
$xmlstring = '';
while( $data = fread( $fp, 100000 ) ) {
$xmlstring .= $data;
}
return $xmlstring;
}
$this->success = 2;
$xmlParser = $this->create_parser();
// Process the file
while( $data = fread( $fp, 4096 ) ) {
if( !xml_parse( $xmlParser, $data, feof( $fp ) ) ) {
die( sprintf(
"XML error: %s at line %d",
xml_error_string( xml_get_error_code( $xmlParser) ),
xml_get_current_line_number( $xmlParser)
) );
}
}
xml_parser_free( $xmlParser );
return $this->sqlArray;
}

| ParseSchemaFile | ( | $ | filename, |
| $ | returnSchema = FALSE |
||
| ) |
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.
| string | $file | Name of XML schema file. |
| bool | $returnSchema | Return schema rather than parsing. |
Definiert in Zeile 1591 der Datei adodb-xmlschema03.inc.php.
{
// Open the file
if( !($fp = fopen( $filename, 'r' )) ) {
logMsg( 'Unable to open file' );
return FALSE;
}
// do version detection here
if( $this->SchemaFileVersion( $filename ) != $this->schemaVersion ) {
logMsg( 'Invalid Schema Version' );
return FALSE;
}
if( $returnSchema ) {
$xmlstring = '';
while( $data = fread( $fp, 4096 ) ) {
$xmlstring .= $data . "\n";
}
return $xmlstring;
}
$this->success = 2;
$xmlParser = $this->create_parser();
// Process the file
while( $data = fread( $fp, 4096 ) ) {
if( !xml_parse( $xmlParser, $data, feof( $fp ) ) ) {
die( sprintf(
"XML error: %s at line %d",
xml_error_string( xml_get_error_code( $xmlParser) ),
xml_get_current_line_number( $xmlParser)
) );
}
}
xml_parser_free( $xmlParser );
return $this->sqlArray;
}

| ParseSchemaString | ( | $ | xmlstring, |
| $ | returnSchema = FALSE |
||
| ) |
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.
| string | $xmlstring | XML schema string. |
| bool | $returnSchema | Return schema rather than parsing. |
Definiert in Zeile 1487 der Datei adodb-xmlschema.inc.php.
{
if( !is_string( $xmlstring ) OR empty( $xmlstring ) ) {
return FALSE;
}
// do version detection here
if( $this->SchemaStringVersion( $xmlstring ) != $this->schemaVersion ) {
return FALSE;
}
if ( $returnSchema )
{
return $xmlstring;
}
$this->success = 2;
$xmlParser = $this->create_parser();
if( !xml_parse( $xmlParser, $xmlstring, TRUE ) ) {
die( sprintf(
"XML error: %s at line %d",
xml_error_string( xml_get_error_code( $xmlParser) ),
xml_get_current_line_number( $xmlParser)
) );
}
xml_parser_free( $xmlParser );
return $this->sqlArray;
}


| ParseSchemaString | ( | $ | xmlstring, |
| $ | returnSchema = FALSE |
||
| ) |
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.
| string | $xmlstring | XML schema string. |
| bool | $returnSchema | Return schema rather than parsing. |
Definiert in Zeile 1643 der Datei adodb-xmlschema03.inc.php.
{
if( !is_string( $xmlstring ) OR empty( $xmlstring ) ) {
logMsg( 'Empty or Invalid Schema' );
return FALSE;
}
// do version detection here
if( $this->SchemaStringVersion( $xmlstring ) != $this->schemaVersion ) {
logMsg( 'Invalid Schema Version' );
return FALSE;
}
if( $returnSchema ) {
return $xmlstring;
}
$this->success = 2;
$xmlParser = $this->create_parser();
if( !xml_parse( $xmlParser, $xmlstring, TRUE ) ) {
die( sprintf(
"XML error: %s at line %d",
xml_error_string( xml_get_error_code( $xmlParser) ),
xml_get_current_line_number( $xmlParser)
) );
}
xml_parser_free( $xmlParser );
return $this->sqlArray;
}

| prefix | ( | $ | name = '' | ) |
Returns an object name with the current prefix prepended.
| string | $name | Name |
private
Definiert in Zeile 2079 der Datei adodb-xmlschema.inc.php.
{
// if prefix is set
if( !empty( $this->objectPrefix ) ) {
// Prepend the object prefix to the table name
// prepend after quote if used
return preg_replace( '/^(`?)(.+)$/', '$1' . $this->objectPrefix . '$2', $name );
}
// No prefix set. Use name provided.
return $name;
}
| prefix | ( | $ | name = '' | ) |
Returns an object name with the current prefix prepended.
| string | $name | Name |
private
Definiert in Zeile 2251 der Datei adodb-xmlschema03.inc.php.
{
// if prefix is set
if( !empty( $this->objectPrefix ) ) {
// Prepend the object prefix to the table name
// prepend after quote if used
return preg_replace( '/^(`?)(.+)$/', '$1' . $this->objectPrefix . '$2', $name );
}
// No prefix set. Use name provided.
return $name;
}
| PrintSQL | ( | $ | format = 'NONE' | ) |
Returns the current SQL array.
Call this method to fetch the array of SQL queries resulting from ParseSchema() or ParseSchemaString().
| string | $format | Format: HTML, TEXT, or NONE (PHP array) |
Definiert in Zeile 1595 der Datei adodb-xmlschema.inc.php.
{
$sqlArray = null;
return $this->getSQL( $format, $sqlArray );
}

| PrintSQL | ( | $ | format = 'NONE' | ) |
Returns the current SQL array.
Call this method to fetch the array of SQL queries resulting from ParseSchema() or ParseSchemaString().
| string | $format | Format: HTML, TEXT, or NONE (PHP array) |
Definiert in Zeile 1752 der Datei adodb-xmlschema03.inc.php.
{
$sqlArray = null;
return $this->getSQL( $format, $sqlArray );
}

| RemoveSchema | ( | $ | filename, |
| $ | returnSchema = FALSE |
||
| ) |
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.
| string | $file | Name of XML schema file. |
| bool | $returnSchema | Return schema rather than parsing. |
Definiert in Zeile 1530 der Datei adodb-xmlschema.inc.php.
{
return $this->RemoveSchemaString( $this->ConvertSchemaFile( $filename ), $returnSchema );
}

| RemoveSchema | ( | $ | filename, |
| $ | returnSchema = FALSE |
||
| ) |
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.
| string | $file | Name of XML schema file. |
| bool | $returnSchema | Return schema rather than parsing. |
Definiert in Zeile 1687 der Datei adodb-xmlschema03.inc.php.
{
return $this->RemoveSchemaString( $this->ConvertSchemaFile( $filename ), $returnSchema );
}

| RemoveSchemaString | ( | $ | schema, |
| $ | returnSchema = FALSE |
||
| ) |
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.
| string | $schema | XML schema string. |
| bool | $returnSchema | Return schema rather than parsing. |
Definiert in Zeile 1545 der Datei adodb-xmlschema.inc.php.
{
// grab current version
if( !( $version = $this->SchemaStringVersion( $schema ) ) ) {
return FALSE;
}
return $this->ParseSchemaString( $this->TransformSchema( $schema, 'remove-' . $version), $returnSchema );
}


| RemoveSchemaString | ( | $ | schema, |
| $ | returnSchema = FALSE |
||
| ) |
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.
| string | $schema | XML schema string. |
| bool | $returnSchema | Return schema rather than parsing. |
Definiert in Zeile 1702 der Datei adodb-xmlschema03.inc.php.
{
// grab current version
if( !( $version = $this->SchemaStringVersion( $schema ) ) ) {
return FALSE;
}
return $this->ParseSchemaString( $this->TransformSchema( $schema, 'remove-' . $version), $returnSchema );
}

| SaveSQL | ( | $ | filename = './schema.sql' | ) |
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.
| string | $filename | Path and name where the file should be saved. |
Definiert in Zeile 1609 der Datei adodb-xmlschema.inc.php.
{
if( !isset( $sqlArray ) ) {
$sqlArray = $this->sqlArray;
}
if( !isset( $sqlArray ) ) {
return FALSE;
}
$fp = fopen( $filename, "w" );
foreach( $sqlArray as $key => $query ) {
fwrite( $fp, $query . ";\n" );
}
fclose( $fp );
}
| SaveSQL | ( | $ | filename = './schema.sql' | ) |
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.
| string | $filename | Path and name where the file should be saved. |
Definiert in Zeile 1766 der Datei adodb-xmlschema03.inc.php.
{
if( !isset( $sqlArray ) ) {
$sqlArray = $this->sqlArray;
}
if( !isset( $sqlArray ) ) {
return FALSE;
}
$fp = fopen( $filename, "w" );
foreach( $sqlArray as $key => $query ) {
fwrite( $fp, $query . ";\n" );
}
fclose( $fp );
}
| SchemaFileVersion | ( | $ | filename | ) |
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.
| string | $filename | AXMLS schema file |
Definiert in Zeile 1891 der Datei adodb-xmlschema.inc.php.
{
// Open the file
if( !($fp = fopen( $filename, 'r' )) ) {
// die( 'Unable to open file' );
return FALSE;
}
// Process the file
while( $data = fread( $fp, 4096 ) ) {
if( preg_match( $this->versionRegex, $data, $matches ) ) {
return !empty( $matches[2] ) ? $matches[2] : XMLS_DEFAULT_SCHEMA_VERSION;
}
}
return FALSE;
}

| SchemaFileVersion | ( | $ | filename | ) |
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.
| string | $filename | AXMLS schema file |
Definiert in Zeile 2051 der Datei adodb-xmlschema03.inc.php.
{
// Open the file
if( !($fp = fopen( $filename, 'r' )) ) {
// die( 'Unable to open file' );
return FALSE;
}
// Process the file
while( $data = fread( $fp, 4096 ) ) {
if( preg_match( $this->versionRegex, $data, $matches ) ) {
return !empty( $matches[2] ) ? $matches[2] : XMLS_DEFAULT_SCHEMA_VERSION;
}
}
return FALSE;
}
| SchemaStringVersion | ( | $ | xmlstring | ) |
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.
| string | $xmlstring | XML schema string |
Definiert in Zeile 1917 der Datei adodb-xmlschema.inc.php.
{
if( !is_string( $xmlstring ) OR empty( $xmlstring ) ) {
return FALSE;
}
if( preg_match( $this->versionRegex, $xmlstring, $matches ) ) {
return !empty( $matches[2] ) ? $matches[2] : XMLS_DEFAULT_SCHEMA_VERSION;
}
return FALSE;
}

| SchemaStringVersion | ( | $ | xmlstring | ) |
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.
| string | $xmlstring | XML schema string |
Definiert in Zeile 2077 der Datei adodb-xmlschema03.inc.php.
{
if( !is_string( $xmlstring ) OR empty( $xmlstring ) ) {
return FALSE;
}
if( preg_match( $this->versionRegex, $xmlstring, $matches ) ) {
return !empty( $matches[2] ) ? $matches[2] : XMLS_DEFAULT_SCHEMA_VERSION;
}
return FALSE;
}
| SetPrefix | ( | $ | prefix = '', |
| $ | underscore = TRUE |
||
| ) |
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.
| string | $prefix | Prefix that will be prepended. |
| boolean | $underscore | If TRUE, automatically append an underscore character to the prefix. |
Definiert in Zeile 2046 der Datei adodb-xmlschema.inc.php.
{
switch( TRUE ) {
// clear prefix
case empty( $prefix ):
logMsg( 'Cleared prefix' );
$this->objectPrefix = '';
return TRUE;
// prefix too long
case strlen( $prefix ) > XMLS_PREFIX_MAXLEN:
// prefix contains invalid characters
case !preg_match( '/^[a-z][a-z0-9_]+$/i', $prefix ):
logMsg( 'Invalid prefix: ' . $prefix );
return FALSE;
}
if( $underscore AND substr( $prefix, -1 ) != '_' ) {
$prefix .= '_';
}
// prefix valid
logMsg( 'Set prefix: ' . $prefix );
$this->objectPrefix = $prefix;
return TRUE;
}
| SetPrefix | ( | $ | prefix = '', |
| $ | underscore = TRUE |
||
| ) |
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.
| string | $prefix | Prefix that will be prepended. |
| boolean | $underscore | If TRUE, automatically append an underscore character to the prefix. |
Definiert in Zeile 2218 der Datei adodb-xmlschema03.inc.php.
{
switch( TRUE ) {
// clear prefix
case empty( $prefix ):
logMsg( 'Cleared prefix' );
$this->objectPrefix = '';
return TRUE;
// prefix too long
case strlen( $prefix ) > XMLS_PREFIX_MAXLEN:
// prefix contains invalid characters
case !preg_match( '/^[a-z][a-z0-9_]+$/i', $prefix ):
logMsg( 'Invalid prefix: ' . $prefix );
return FALSE;
}
if( $underscore AND substr( $prefix, -1 ) != '_' ) {
$prefix .= '_';
}
// prefix valid
logMsg( 'Set prefix: ' . $prefix );
$this->objectPrefix = $prefix;
return TRUE;
}
| SetUpgradeMethod | ( | $ | method = '' | ) |
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.
| string | $method | Upgrade method (ALTER|REPLACE|BEST|NONE) |
Definiert in Zeile 1336 der Datei adodb-xmlschema.inc.php.
{
if( !is_string( $method ) ) {
return FALSE;
}
$method = strtoupper( $method );
// Handle the upgrade methods
switch( $method ) {
case 'ALTER':
$this->upgrade = $method;
break;
case 'REPLACE':
$this->upgrade = $method;
break;
case 'BEST':
$this->upgrade = 'ALTER';
break;
case 'NONE':
$this->upgrade = 'NONE';
break;
default:
// Use default if no legitimate method is passed.
$this->upgrade = XMLS_DEFAULT_UPGRADE_METHOD;
}
return $this->upgrade;
}
| SetUpgradeMethod | ( | $ | method = '' | ) |
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.
| string | $method | Upgrade method (ALTER|REPLACE|BEST|NONE) |
Definiert in Zeile 1441 der Datei adodb-xmlschema03.inc.php.
{
if( !is_string( $method ) ) {
return FALSE;
}
$method = strtoupper( $method );
// Handle the upgrade methods
switch( $method ) {
case 'ALTER':
$this->upgrade = $method;
break;
case 'REPLACE':
$this->upgrade = $method;
break;
case 'BEST':
$this->upgrade = 'ALTER';
break;
case 'NONE':
$this->upgrade = 'NONE';
break;
default:
// Use default if no legitimate method is passed.
$this->upgrade = XMLS_DEFAULT_UPGRADE_METHOD;
}
return $this->upgrade;
}
| supportedPlatform | ( | $ | platform = NULL | ) |
Checks if element references a specific platform
| string | $platform | Requested platform |
private
Definiert in Zeile 2099 der Datei adodb-xmlschema.inc.php.
{
$regex = '/^(\w*\|)*' . $this->db->databaseType . '(\|\w*)*$/';
if( !isset( $platform ) OR preg_match( $regex, $platform ) ) {
logMsg( "Platform $platform is supported" );
return TRUE;
} else {
logMsg( "Platform $platform is NOT supported" );
return FALSE;
}
}

| supportedPlatform | ( | $ | platform = NULL | ) |
Checks if element references a specific platform
| string | $platform | Requested platform |
private
Definiert in Zeile 2271 der Datei adodb-xmlschema03.inc.php.
{
if( !empty( $platform ) ) {
$regex = '/(^|\|)' . $this->db->databaseType . '(\||$)/i';
if( preg_match( '/^- /', $platform ) ) {
if (preg_match ( $regex, substr( $platform, 2 ) ) ) {
logMsg( 'Platform ' . $platform . ' is NOT supported' );
return FALSE;
}
} else {
if( !preg_match ( $regex, $platform ) ) {
logMsg( 'Platform ' . $platform . ' is NOT supported' );
return FALSE;
}
}
}
logMsg( 'Platform ' . $platform . ' is supported' );
return TRUE;
}
| xslt_error_handler | ( | $ | parser, |
| $ | errno, | ||
| $ | level, | ||
| $ | fields | ||
| ) |
Processes XSLT transformation errors
| object | $parser | XML parser object |
| integer | $errno | Error number |
| integer | $level | Error level |
| array | $fields | Error information fields |
private
Definiert in Zeile 1839 der Datei adodb-xmlschema.inc.php.
{
if( is_array( $fields ) ) {
$msg = array(
'Message Type' => ucfirst( $fields['msgtype'] ),
'Message Code' => $fields['code'],
'Message' => $fields['msg'],
'Error Number' => $errno,
'Level' => $level
);
switch( $fields['URI'] ) {
case 'arg:/_xml':
$msg['Input'] = 'XML';
break;
case 'arg:/_xsl':
$msg['Input'] = 'XSL';
break;
default:
$msg['Input'] = $fields['URI'];
}
$msg['Line'] = $fields['line'];
} else {
$msg = array(
'Message Type' => 'Error',
'Error Number' => $errno,
'Level' => $level,
'Fields' => var_export( $fields, TRUE )
);
}
$error_details = $msg['Message Type'] . ' in XSLT Transformation' . "\n"
. '<table>' . "\n";
foreach( $msg as $label => $details ) {
$error_details .= '<tr><td><b>' . $label . ': </b></td><td>' . htmlentities( $details ) . '</td></tr>' . "\n";
}
$error_details .= '</table>';
trigger_error( $error_details, E_USER_ERROR );
}
| xslt_error_handler | ( | $ | parser, |
| $ | errno, | ||
| $ | level, | ||
| $ | fields | ||
| ) |
Processes XSLT transformation errors
| object | $parser | XML parser object |
| integer | $errno | Error number |
| integer | $level | Error level |
| array | $fields | Error information fields |
private
Definiert in Zeile 1999 der Datei adodb-xmlschema03.inc.php.
{
if( is_array( $fields ) ) {
$msg = array(
'Message Type' => ucfirst( $fields['msgtype'] ),
'Message Code' => $fields['code'],
'Message' => $fields['msg'],
'Error Number' => $errno,
'Level' => $level
);
switch( $fields['URI'] ) {
case 'arg:/_xml':
$msg['Input'] = 'XML';
break;
case 'arg:/_xsl':
$msg['Input'] = 'XSL';
break;
default:
$msg['Input'] = $fields['URI'];
}
$msg['Line'] = $fields['line'];
} else {
$msg = array(
'Message Type' => 'Error',
'Error Number' => $errno,
'Level' => $level,
'Fields' => var_export( $fields, TRUE )
);
}
$error_details = $msg['Message Type'] . ' in XSLT Transformation' . "\n"
. '<table>' . "\n";
foreach( $msg as $label => $details ) {
$error_details .= '<tr><td><b>' . $label . ': </b></td><td>' . htmlentities( $details ) . '</td></tr>' . "\n";
}
$error_details .= '</table>';
trigger_error( $error_details, E_USER_ERROR );
}