DataFaucet 1.0 Beta

datafaucet.system
Class schemaexport

WEB-INF.cftags.component
        extended by datafaucet.system.kernel
            extended by datafaucet.system.duck
                extended by datafaucet.system.schemaexport

public class schemaexport
extends duck

This component exports the schema for a set of tables as an XML packet that can be executed by a datasource object to create tables in an alternate datasource


Constructor Summary
init([string tables='*'], [any datasource=''])
 
Method Summary
private string addReferenceAttribute(string column, string references)
          removes autonumber and primary key attributes from an xml column string and replaces them with a references attribute
private query getColumns(string table)
          gets a list of columns for a specified table
 string getDDL()
 any getDDLFromObject(any object, [string table=''])
private any getDateDefault(string content)
 string getDiff(string New, string Old, [string drop=''])
private string getDiffXSLT()
private struct getImportedKeyStruct(string table)
private query getImportedKeys(string table)
          returns primary keys that have been imported into a specified table
private struct getPrimaryKeyFromProperties(string table, array properties)
          returns a structure containing the attributes of a cfproperty tag specified as a primary key
private query getPrimaryKeys(string table)
          gets primary key constraints for a specified table
private any getSequenceFromObject(any object)
 string getUpgradeDiff(string New, [string drop=''])
private any raiseXrefPrimaryKeyException(string table, string references)
private any raiseXrefReferenceException(string property, string xref)
private any set_datasource()
          prevents datasource from being set as a property of the export object
private string set_tables(string propertyname, string propertyvalue)
          sets the list of tables to export - allows wild-cards
private string writeColumn(string name, string type, [string nullable='true'], [string def=''], [string size=''], [string size2=''], [string references=''], [boolean autonumber='false'])
private string writeColumnFromProperty(string name, [string type='string'], [string required='false'], [string default=''], [string length=''], [string references=''], [boolean autonumber='false'], [boolean key='false'])
private string writeCrossReferenceFromProperty(string name, string table, struct primary, string references, string xref)
          creates the XML syntax for a cross-reference table from a cfproperty tag
private string writeTable(string table)
 
Methods inherited from class datafaucet.system.duck
addObserver, getObservers, getProperties, getProperty, getPropertylist, getValue, identifyAccessorOrMutator, observe, onMissingMethod, raiseMissingMethodException, reset, setProperties, setProperty, setValue
 
Methods inherited from class datafaucet.system.kernel
arg, componentExists, getDataFaucet, getFaucetObject, getFile, getFileModified, getObject, getPlumbing, getTransaction, getTransactionManager, newTransaction, parseDate, setTransaction
 
Methods inherited from class WEB-INF.cftags.component
 

Constructor Detail

init

public init([string tables='*'], [any datasource=''])

Parameters:
tables
datasource
Method Detail

addReferenceAttribute

private string addReferenceAttribute(string column, string references)
removes autonumber and primary key attributes from an xml column string and replaces them with a references attribute

Parameters:
column
references

getColumns

private query getColumns(string table)
gets a list of columns for a specified table

Parameters:
table

getDDL

public string getDDL()


getDDLFromObject

public any getDDLFromObject(any object, [string table=''])

Parameters:
object - an object from which properties are discovered
table - allows the name of the table to be declared explicitly

getDateDefault

private any getDateDefault(string content)

Parameters:
content

getDiff

public string getDiff(string New, string Old, [string drop=''])

Parameters:
New - an XML packet containing the DDL definition for the new schema
Old - an XML packet containing an old DDL definition to be upgraded
drop - comma-delimited list allows entities to be dropped during upgrade - options are tables, columns, views, procedures

getDiffXSLT

private string getDiffXSLT()


getImportedKeyStruct

private struct getImportedKeyStruct(string table)

Parameters:
table

getImportedKeys

private query getImportedKeys(string table)
returns primary keys that have been imported into a specified table

Parameters:
table - the name of the table to return key data from

getPrimaryKeyFromProperties

private struct getPrimaryKeyFromProperties(string table, array properties)
returns a structure containing the attributes of a cfproperty tag specified as a primary key

Parameters:
table
properties

getPrimaryKeys

private query getPrimaryKeys(string table)
gets primary key constraints for a specified table

Parameters:
table - the name of the table to return key data from

getSequenceFromObject

private any getSequenceFromObject(any object)

Parameters:
object

getUpgradeDiff

public string getUpgradeDiff(string New, [string drop=''])

Parameters:
New - an XML packet containing the DDL definition for the new schema - existing schema to compare will be exported from the database using the getDDL method
drop - comma-delimited list allows entities to be dropped during upgrade - options are tables, columns, views, procedures

raiseXrefPrimaryKeyException

private any raiseXrefPrimaryKeyException(string table, string references)

Parameters:
table
references

raiseXrefReferenceException

private any raiseXrefReferenceException(string property, string xref)

Parameters:
property
xref

set_datasource

private any set_datasource()
prevents datasource from being set as a property of the export object


set_tables

private string set_tables(string propertyname, string propertyvalue)
sets the list of tables to export - allows wild-cards

Parameters:
propertyname
propertyvalue

writeColumn

private string writeColumn(string name, string type, [string nullable='true'], [string def=''], [string size=''], [string size2=''], [string references=''], [boolean autonumber='false'])

Parameters:
name
type
nullable
def
size
size2
references
autonumber

writeColumnFromProperty

private string writeColumnFromProperty(string name, [string type='string'], [string required='false'], [string default=''], [string length=''], [string references=''], [boolean autonumber='false'], [boolean key='false'])

Parameters:
name
type
required
default
length
references
autonumber
key

writeCrossReferenceFromProperty

private string writeCrossReferenceFromProperty(string name, string table, struct primary, string references, string xref)
creates the XML syntax for a cross-reference table from a cfproperty tag

Parameters:
name
table
primary
references
xref

writeTable

private string writeTable(string table)

Parameters:
table

DataFaucet 1.0 Beta