Database API

Database API

clearLog()

Clears the SQL log

Arguments

createChange()

Shortcut function for creating change structs

Arguments

NameTypeRequiredDefaultOptionsDescription
None
NameTypeRequiredDefaultOptionsDescription
actionstringYesThe name of the gateway function to run
schemastructYesThe relevant table schema
propertynamestringNoThe property to update
indexnamestringNoThe index to update
bDropTablebooleanNoUsed for table deployments

createData()

Create an object including array properties. Pass in a structure of property values; arrays should be passed as an array. The objectID can be ommitted and one will be created, passed in as an argument or passed in as a key of stProperties argument.

Arguments

NameTypeRequiredDefaultOptionsDescription
typenamestringYesThe name of the content type
stPropertiesstructYes
dsnstringYes

createFieldStruct()

Creates a field struct from metadata

Arguments

NameTypeRequiredDefaultOptionsDescription
namestringYes
nullablebooleanYes
typestringYes
precisionstringNo
bPrimaryKeybooleanNofalse
defaultanyNo
indexstringNo
savablebooleanNotrue

deleteData()

Delete the specified objectid and corresponding data, including array properties and refObjects.

Arguments

NameTypeRequiredDefaultOptionsDescription
typenamestringYesThe name of the content type
dsnstringYes

deployChanges()

Processes an array of changes and returns an array of results

Arguments

NameTypeRequiredDefaultOptionsDescription
changesarrayYesArray of changes in the form { action, schema, propertyname|indexname, bDropTable(deploySchema only) }. Other properties can be included but will be ignored.
dsnstringYesThe database to update

deployDefaultChanges()

Deploys all default schema changes and returns the results

Arguments

NameTypeRequiredDefaultOptionsDescription
typesstringNo*

deployType()

Arguments

NameTypeRequiredDefaultOptionsDescription
typenamestringYesThe name of the content type
bDropTablebooleanYes
dsnstringYes

diffSchema()

Compares type metadata to the actual database schema

Arguments

NameTypeRequiredDefaultOptionsDescription
typenamestringYesThe name of the content type
dsnstringYes

dropType()

Arguments

NameTypeRequiredDefaultOptionsDescription
typenamestringYesThe name of the content type
dsnstringYes

getData()

Get data for a specific objectid and return as a structure, including array properties and typename.

Arguments

NameTypeRequiredDefaultOptionsDescription
typenamestringYesThe name of the content type
bDepthnumericNo10:Everything (with full structs for all array field elements),1:Everything (only extended array field as structs),2:No array fields,3:No array or longchar fields
fieldsstringNoOverrides the default fields returned. NOTE: the bDepth field may restrict the list further.
dsnstringYes

getDBTypes()

Returns a struct mapping dbtype keys to their gateway components

Arguments

getDefaultChanges()

Takes a table conflict struct and property/index name, and generates an array of default change structs for deployChanges.

Arguments

NameTypeRequiredDefaultOptionsDescription
None
NameTypeRequiredDefaultOptionsDescription
stDiffstructYesConflict struct for a table
propertynamestringNoSpecific property
indexnamestringNoSpecific index

getGateway()

Gets the gateway for the given db connection parameters

Arguments

NameTypeRequiredDefaultOptionsDescription
dsnstringYes
dbtypestringNo
dbownerstringNo

getLog()

Loads and returns the SQL log

Arguments

NameTypeRequiredDefaultOptionsDescription
asArraybooleanNofalse

getLogChangeFlags()

Returns a list of the types that are flaged to have all SQL logged

Arguments

getLogLocation()

Sets the file to which SQL is logged

Arguments

NameTypeRequiredDefaultOptionsDescription
None

getTableMetadata()

Returns the metadata for a given content type

Arguments

NameTypeRequiredDefaultOptionsDescription
None
NameTypeRequiredDefaultOptionsDescription
typenamestringYesThe name of the content type

init()

Arguments

NameTypeRequiredDefaultOptionsDescription
dsnstringNo#application.dsn#
dbtypestringNo#application.dbtype#
dbownerstringNo#application.dbowner#
loglocationstringNo

initialiseGateway()

Creates the gateway for a set of connection parameters

Arguments

NameTypeRequiredDefaultOptionsDescription
dsnstringYes
dbtypestringYes
dbownerstringYes

initialiseTableMetadata()

Initialises and returns table metadata for a given content type

Arguments

NameTypeRequiredDefaultOptionsDescription
typenameanyYesThe package path or type component to process
schemastructNoUse to provide a manually generated schema

isDeployed()

Returns True if the table is already deployed

Arguments

NameTypeRequiredDefaultOptionsDescription
typenamestringYesThe name of the content type
dsnstringNo#application.dsn#

mergeChanges()

Merges two arrays of changes. Yes, this is just an array merge function.

Arguments

NameTypeRequiredDefaultOptionsDescription
changesAarrayYes
changesBarrayYes

parseArrayFields()

Parses the data out of cfproperty tag for array properties

Arguments

NameTypeRequiredDefaultOptionsDescription
datastructYes

parseComponentMetadata()

Parses the given component metadata structure and generates metadata that can be used by the DBGateway components.

Arguments

NameTypeRequiredDefaultOptionsDescription
mdstructYes
existingstructNo#structnew()#Metadata so far

parseProperty()

Parses the data out of cfproperty tag metadata and inserts default values for unspecified attributes

Arguments

NameTypeRequiredDefaultOptionsDescription
datastructYesStruct out of the getMetadata struct for a property
parenttablestringYesThe name of the parent table

run()

Simplifies access to gateway specific functions provided by plugins or projects. Returns false if the mixin does not exist.

Arguments

NameTypeRequiredDefaultOptionsDescription
namestringYesThe name of the mixin function to run
dsnstringYes

setArrayData()

Passes update an array update to the gateway

Arguments

NameTypeRequiredDefaultOptionsDescription
typenamestringYesThe name of the content type
propertynamestringYes
objectidUUIDYes
aPropertiesarrayYes
dsnstringYes

setData()

Passes update data to the gateway

Arguments

NameTypeRequiredDefaultOptionsDescription
typenamestringYesThe name of the content type
stPropertiesstringYes
dsnstringYes

setLogChangeFlags()

Sets the list of the types that are flaged to have all SQL logged

Arguments

NameTypeRequiredDefaultOptionsDescription
logChangesstringYes

setLogLocation()

Sets the file to which SQL is logged

Arguments

NameTypeRequiredDefaultOptionsDescription
logLocationstringYes