v5:axmls:axmls_index
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
v5:axmls:axmls_index [2018/07/01 22:15] – prefer functions start lowercase (#430) peterdd | v5:axmls:axmls_index [2020/01/12 22:46] – example descr fix and a bit PSR-12 code style peterdd | ||
---|---|---|---|
Line 30: | Line 30: | ||
</ | </ | ||
===== Installation ===== | ===== Installation ===== | ||
- | This feature is included in the standard release | + | This feature is included in the standard release. |
===== Using AXMLS in Your Application ===== | ===== Using AXMLS in Your Application ===== | ||
There are two steps involved in using AXMLS in your application: | There are two steps involved in using AXMLS in your application: | ||
Line 40: | Line 40: | ||
<?xml version=" | <?xml version=" | ||
<schema version=" | <schema version=" | ||
- | |||
<table name=" | <table name=" | ||
- | <desc>A typical users table for our application.</ | + | <descr>A typical users table for our application.</ |
<field name=" | <field name=" | ||
< | < | ||
< | < | ||
< | < | ||
- | </ | + | </ |
- | | + | |
<field name=" | <field name=" | ||
- | | ||
<index name=" | <index name=" | ||
< | < | ||
Line 57: | Line 54: | ||
</ | </ | ||
</ | </ | ||
- | | ||
<sql> | <sql> | ||
< | < | ||
Line 66: | Line 62: | ||
</ | </ | ||
- | Let's take a detailed look at this schema. The opening ''<? | + | Let's take a detailed look at this schema. The opening ''<? |
<code xml> | <code xml> | ||
Line 79: | Line 75: | ||
<code xml> | <code xml> | ||
<table name=" | <table name=" | ||
- | + | | |
- | | + | |
<field name=" | <field name=" | ||
< | < | ||
Line 86: | Line 81: | ||
< | < | ||
</ | </ | ||
- | | ||
<field name=" | <field name=" | ||
- | | ||
</ | </ | ||
</ | </ | ||
Line 94: | Line 87: | ||
This table is called " | This table is called " | ||
- | * The description is optional, and is currently | + | * The description is optional, and is currently only for your own information; |
* The first < | * The first < | ||
* The second < | * The second < | ||
Line 105: | Line 98: | ||
<table name=" | <table name=" | ||
... | ... | ||
- | | ||
<index name=" | <index name=" | ||
< | < | ||
< | < | ||
< | < | ||
- | </ | + | </ |
- | | + | |
</ | </ | ||
</ | </ | ||
Line 123: | Line 114: | ||
<sql> | <sql> | ||
< | < | ||
- | < | + | < |
- | < | + | < |
</ | </ | ||
</ | </ | ||
Line 154: | Line 145: | ||
/* Start by creating a normal ADODB connection. | /* Start by creating a normal ADODB connection. | ||
*/ | */ | ||
- | $db = ADONewConnection( $platform ); | + | $db = ADONewConnection($platform); |
- | $db-> | + | $db-> |
/* Use the database connection to create a new adoSchema object. | /* Use the database connection to create a new adoSchema object. | ||
*/ | */ | ||
- | $schema = new adoSchema( $db ); | + | $schema = new adoSchema($db); |
- | /* Call ParseSchema() to build SQL from the XML schema file. | + | /* Call parseSchema() to build SQL from the XML schema file. |
- | * Then call ExecuteSchema() to apply the resulting SQL to | + | * Then call executeSchema() to apply the resulting SQL to |
* the database. | * the database. | ||
*/ | */ | ||
- | $sql = $schema-> | + | $sql = $schema-> |
$result = $schema-> | $result = $schema-> | ||
</ | </ | ||
Line 172: | Line 163: | ||
<code php> | <code php> | ||
- | $db = ADONewConnection( | + | $db = ADONewConnection($platform); |
- | $db-> | + | $db-> |
</ | </ | ||
Line 179: | Line 170: | ||
<code php> | <code php> | ||
- | $schema = new adoSchema( $db ); | + | $schema = new adoSchema($db); |
</ | </ | ||
- | Third, call ParseSchema() to parse the schema and then '' | + | Third, call parseSchema() to parse the schema and then '' |
<code php> | <code php> | ||
- | $schema-> | + | $schema-> |
$schema-> | $schema-> | ||
</ | </ | ||
Line 201: | Line 192: | ||
<code php> | <code php> | ||
- | $schema = new adoSchema( $this-> | + | $schema = new adoSchema($this-> |
// Inline Execution | // Inline Execution | ||
- | $schema-> | + | $schema-> |
- | $schema-> | + | $schema-> |
- | $schema-> | + | $schema-> |
</ | </ | ||
Line 212: | Line 203: | ||
<code php> | <code php> | ||
- | $schema = new adoSchema( $this-> | + | $schema = new adoSchema($this-> |
// Post Execution (default) | // Post Execution (default) | ||
- | $schema-> | + | $schema-> |
- | $schema-> | + | $schema-> |
$schema-> | $schema-> | ||
</ | </ | ||
Line 227: | Line 218: | ||
<code php> | <code php> | ||
- | $schema = new adoSchema( $this-> | + | $schema = new adoSchema($this-> |
// Set the prefix for database objects (before parsing) | // Set the prefix for database objects (before parsing) | ||
- | $schema-> | + | $schema-> |
</ | </ | ||
==== Getting at the SQL ==== | ==== Getting at the SQL ==== | ||
Line 237: | Line 228: | ||
<code php> | <code php> | ||
- | $schema-> | + | $schema-> |
$schema-> | $schema-> | ||
- | print( $schema-> | + | print $schema-> |
- | print( $schema-> | + | print $schema-> |
$sql = $schema-> | $sql = $schema-> | ||
// Save SQL to file | // Save SQL to file | ||
- | $schema-> | + | $schema-> |
</ | </ | ||
As always, see the Class Documentation for detailed information about the methods. | As always, see the Class Documentation for detailed information about the methods. |
v5/axmls/axmls_index.txt · Last modified: 2020/01/13 15:52 by dregad