I manage data interactions with the database. I can be used/extended by a component to handle inserts/updates.
| hierarchy: | WEB-INF.cftags.component com.sebtools.DataMgr | 
| properties: | |
| methods: | init, addColumn, CreateTable, CreateTables, deleteRecord, getCFDataType, getCreateSQL, getDatabase, getDatabaseShortString, getDatabaseTables, getDatasource, getDBDataType, getDBFieldList, getDBTableStruct, getFieldList, getMaxRowsPrefix, getMaxRowsSuffix, getNewSortNum, getPKFields, getPKFromData, getRecord, getRecords, getStringTypes, getSupportedDatabases, getTableData, getUpdateableFields, getXML, insertRecord, loadTable, loadXML, saveRecord, saveRelationList, saveSortOrder, truncate, updateRecord | 
| init | 
|---|
|  public DataMgr init (  required string  datasource ) I instantiate and return this object. Output: suppressed Parameters: datasource: string, required, datasource | 
| addColumn | 
|  public any addColumn (  required  		string  tablename,  required  		string  columnname,  required  		string  CF_Datatype,  numeric  Length="50",  string  Default  		  	) I add a column to the given table Output: supressed Parameters: tablename: string, required, tablename - The name of the table to which a column will be added. columnname: string, required, columnname - The name of the column to add. CF_Datatype: string, required, CF_Datatype - The ColdFusion SQL Datatype of the column. Length: numeric, optional, Length - The ColdFusion SQL Datatype of the column. Default: string, optional, Default - The default value for the column. | 
| createTable | 
|  public string createTable (  required  		string  tablename  		  	) I take a table for which the structure has been loaded, and create the table in the database. Output: supressed Parameters: tablename: string, required, tablename | 
| CreateTables | 
|  public void CreateTables (  string  tables="[runtime expression]"  		  	) I create any tables that I know should exist in the database but don't. Output: supressed Parameters: tables: string, optional, tables - I am a list of tables to create. If I am not provided createTables will try to create any table that has been loaded into it but does not exist in the database. | 
| deleteRecord | 
|  public void deleteRecord (  required  		string  tablename,  required  		struct  data  		  	)I delete the record with the given Primary Key(s). Output: supressed Parameters: tablename: string, required, tablename - The name of the table from which to delete a record. data: struct, required, data - A structure indicating the record to delete. A key indicates a field. The structure should have a key for each primary key in the table. | 
| getCFDataType | 
|  public string getCFDataType (  required  		string  type  		  	) I return the cfqueryparam datatype from the database datatype. Output: supressed Parameters: type: string, required, type - The database data type. | 
| getCreateSQL | 
| public string getCreateSQL (  required  		string  tablename  		  	) I return the SQL to create the given table. Output: supressed Parameters: tablename: string, required, tablename - The name of the table to create. | 
| getDatabase | 
|  public string getDatabase (   		  	) I return the database platform being used (Access,MS SQL,MySQL etc). Output: supressed | 
| getDatabaseShortString | 
| public string getDatabaseShortString (   		  	) I return the string that can be found in the driver or JDBC URL for the database platform being used. Output: supressed | 
| getDatabaseTables | 
|  public string getDatabaseTables ( ) I get a list of all tables in the current database. Output: enabled | 
| getDatasource | 
|  public string getDatasource ( ) I return the datasource used by this Data Manager. Output: suppressed | 
| getDBDataType | 
|  public string getDBDataType (  required string  CF_Datatype ) I return the database datatype from the cfqueryparam datatype. Output: suppressed Parameters: CF_Datatype: string, required, CF_Datatype | 
| getDBFieldList | 
|  public string getDBFieldList (  required  		string  tablename  		  	) I return a list of fields in the database for the given table. Output: supressed Parameters: tablename: string, required, tablename | 
| getDBTableStruct | 
|  public array getDBTableStruct (  required  		string  tablename  		  	) I return the structure of the given table in the database. Output: supressed Parameters: tablename: string, required, tablename | 
| getFieldList | 
|  public string getFieldList (  required string  tablename ) I get a list of fields in the given table. Output: suppressed Parameters: tablename: string, required, tablename | 
| getMaxRowsPrefix | 
| public string getMaxRowsPrefix (  required  		numeric  maxrows  		  	) I get the SQL before the field list in the select statement to limit the number of rows. Output: supressed Parameters: maxrows: numeric, required, maxrows | 
| getMaxRowsSuffix | 
| public string getMaxRowsSuffix (  required  		numeric  maxrows  		  	) I get the SQL before the field list in the select statement to limit the number of rows. Output: supressed Parameters: maxrows: numeric, required, maxrows | 
| getNewSortNum | 
| public numeric getNewSortNum (  required  		string  tablename,  required  		string  sortfield  		  	) Output: supressed Parameters: tablename: string, required, tablename sortfield: string, required, sortfield - The field holding the sort order. | 
| getPKFields | 
|  public array getPKFields (  required string  tablename ) I return an array of primary key fields. Output: suppressed Parameters: tablename: string, required, tablename | 
| getPKFromData | 
|  public string getPKFromData (  required  		string  tablename,  required  		struct  fielddata  		  	) I get the primary key of the record matching the given data. Output: supressed Parameters: tablename: string, required, tablename - The table from which to return a primary key. fielddata: struct, required, fielddata - A structure with the data for the desired record. Each key/value indicates a value for the field matching that key. | 
| getRecord | 
|  public query getRecord (  required  		string  tablename,  required  		struct  data  		  	) I get a recordset based on the primary key value(s) given. Output: supressed Parameters: tablename: string, required, tablename - The table from which to return a record. data: struct, required, data - A structure with the data for the desired record. Each key/value indicates a value for the field matching that key. Every primary key field should be included. | 
| getRecords | 
|  public query getRecords (  required  		string  tablename,  struct  data  		  	) I get a recordset based on the data given. Output: supressed Parameters: tablename: string, required, tablename - The table from which to return a record. data: struct, optional, data - A structure with the data for the desired record. Each key/value indicates a value for the field matching that key. | 
| getStringTypes | 
|  public string getStringTypes (   		  	) I return a list of datypes that hold strings / character values. Output: supressed | 
| getSupportedDatabases | 
| public query getSupportedDatabases (   		  	) I return the databases supported by this install of DataMgr. Output: supressed | 
| getTableData | 
|  public struct getTableData ( ) I return information about all of the tables currently loaded into this Data Manager. Output: suppressed | 
| getUpdateableFields | 
|  public array getUpdateableFields (  required string  tablename ) I return an arry of fields that can be updated. Output: suppressed Parameters: tablename: string, required, tablename | 
| getXML | 
|  public string getXML (  string  tablename  		  	) I return the XML for the given table or for all loaded tables if none given. Output: supressed Parameters: tablename: string, optional, tablename | 
| insertRecord | 
|  public string insertRecord (  required  		string  tablename,  required  		struct  data,  string  OnExists="insert"  		  	) I insert a record into the given table with the provided data and do my best to return the primary key of the inserted record. Output: supressed Parameters: tablename: string, required, tablename - The table in which to insert data. data: struct, required, data - A structure with the data for the desired record. Each key/value indicates a value for the field matching that key. OnExists: string, optional, OnExists - The action to take if a record with the given values exists. Possible values: insert (inserts another record), error (throws an error), update (updates the matching record), skip (performs no action). | 
| loadTable | 
|  public void loadTable (  required  		string  tablename  		  	) I load a table from the database into the DataMgr object. Output: supressed Parameters: tablename: string, required, tablename | 
| loadXML | 
|  public void loadXML (  required  		string  xmldata,  boolean  docreate="false",  boolean  addcolumns="false"  		  	) I add table/tables from XML and optionally create tables/columns as needed (I can also load data to a table upon its creation). Output: supressed Parameters: xmldata: string, required, xmldata - XML data of tables to load into DataMgr follows. Schema: http://www.bryantwebconsulting.com/cfc/DataMgr.xsd docreate: boolean, optional, docreate - I indicate if the table should be created in the database if it doesn't already exist. addcolumns: boolean, optional, addcolumns - I indicate if missing columns should be be created. | 
| saveRecord | 
|  public string saveRecord (  required  		string  tablename,  required  		struct  data  		  	) I insert or update a record in the given table (update if a matching record is found) with the provided data and return the primary key of the updated record. Output: supressed Parameters: tablename: string, required, tablename - The table on which to update data. data: struct, required, data - A structure with the data for the desired record. Each key/value indicates a value for the field matching that key. | 
| saveRelationList | 
| public variableName saveRelationList (  required  		string  tablename,  required  		string  keyfield,  required  		string  keyvalue,  required  		string  multifield,  required  		string  multilist  		  	) Output: supressed Parameters: tablename: string, required, tablename - The table holding the many-to-many relationships. keyfield: string, required, keyfield - The field holding our key value for relationships. keyvalue: string, required, keyvalue - The value of out primary field. multifield: string, required, multifield - The field holding our many relationships for the given key. multilist: string, required, multilist - The list of related values for our key. | 
| saveSortOrder | 
| public void saveSortOrder (  required  		string  tablename,  required  		string  sortfield,  required  		string  sortlist  		  	) Output: supressed Parameters: tablename: string, required, tablename - The table on which to update data. sortfield: string, required, sortfield - The field holding the sort order. sortlist: string, required, sortlist - The list of primary key field values in sort order. | 
| truncate | 
| public struct truncate (  required  		string  tablename,  required  		struct  data  		  	) I return the structure with the values truncated to the limit of the fields in the table. Output: supressed Parameters: tablename: string, required, tablename - The table for which to truncate data. data: struct, required, data - A structure with the data for the desired record. Each key/value indicates a value for the field matching that key. | 
| updateRecord | 
|  public string updateRecord (  required  		string  tablename,  required  		struct  data  		  	) I update a record in the given table with the provided data and return the primary key of the updated record. Output: supressed Parameters: tablename: string, required, tablename - The table on which to update data. data: struct, required, data - A structure with the data for the desired record. Each key/value indicates a value for the field matching that key. |