Classic ASP Framework
org.classicasp.primitive.DatabaseEx

To create a DatabaseEx object, you can use the constructor or the global function, or assign a literal value.

Example 1

	
  Response.Write DatabaseEx("Driver={MySQL ODBC 3.51 Driver};Server=localhost;").connected().toJSON()
  

Example 1 Output

True

Summary

Verifies if a connection has been established.
Commits a record to multiple tables in the database.
Deletes a record from multiple tables in the database.
Explains a datamap.
Parses a datamap.
Selects a record from multiple tables in the database.
Shows a datamap.
Lists all fields in a table.
Lists fields in a table excluding "id", "timestamp_created", "timestamp_updated", "user_created", "user_updated".
Commits a record to a table in the database, requires table name and the record.
Deletes a record from a table in the database, requires table name and the record or record id.
Selects a record (only the id) from a table in the database, requires table name and the record with lookup values.
Determines if a record exists in a table in the database, requires table name and the record with lookup values.
Selects a record (only the id) from a table in the database, requires table name and the record with lookup values.
Selects a record from a table in the database, requires table name and the record with lookup values.
Selects a record from a table in the database, requires table name and the record with lookup values.
Selects a record from a table in the database, requires table name and the record with lookup values.
Determines if a record exists in a table in the database, requires table name and the record or record id.
Selects a record from a table in the database, requires table name and the record or record id.
Selects specific fields in a record from a table in the database, requires table name and the record or record id.
Executes sql against the database and returns boolean.
Executes sql against the database asynchronously.
Executes sql against the database and returns boolean.
Executes sql against the database and returns the result set.
Executes sql against the database and writes the result to a csv file.
Executes sql against the database and returns the result set as a recordset object.
Returns a Bencoded string representation of the object.
Returns a json encoded string representation of the object.
Returns a string representation of the object.
Returns an XML encoded string representation of the object.
Writes a json encoded string representation of the object.
Writes an XML encoded string representation of the object.

connected

Public Function connected()
Verifies if a connection has been established.

Returns

BooleanEx

datamapCommit

Public Function datamapCommit(
ByVal sInputDatamap,
ByVal oInputParameters)
Commits a record to multiple tables in the database.

Example Datamap

  • Use "//" to comment lines.
  • Use a carriage return to separate mappings.
  • Use a ";" to separate pipes.
  • Use "*" to define a field as part of a records's identity.
  • Use "[0...x]" to define aliases for tables to create multiple records.
  • Use "(A=B)" to define value mappings.
	
	  //My Example Datamap	
	  *REC_ID = tbl_example1.REC_ID;tbl_example2[0].REC_ID
	  *DATE = tbl_example1.DATE;tbl_example2[0].DATE
	  FIELD1 = tbl_example1.NAME(0=CBD);tbl_example2[0].NAME(0=CBD)
	  FIELD2 = tbl_example1.INJURY(0=R,1=L,2=B);tbl_example2[0].INJURY(0=R,1=L,2=B)
	  FIELD3 = tbl_example1.GAIT(0=A,1=B,2=C)
	  FIELD4 = tbl_example1.EMAIL
	  

Returns

ObjectEx

datamapDelete

Public Function datamapDelete(
ByVal sInputDatamap,
ByVal oInputParameters)
Deletes a record from multiple tables in the database.

Returns

ObjectEx

datamapExplain

Public Function datamapExplain(ByVal sInputDatamap)
Explains a datamap.

Returns

ObjectEx

datamapParse

Public Function datamapParse(ByVal sInputDatamap)
Parses a datamap.

Returns

ObjectEx

datamapSelect

Public Function datamapSelect(
ByVal sInputDatamap,
ByVal oInputParameters)
Selects a record from multiple tables in the database.

Returns

ObjectEx

datamapShow

Public Function datamapShow(
ByVal sInputDatamap,
ByRef oInputParameters)
Shows a datamap.

Returns

ObjectEx

getTableFieldsAll

Public Function getTableFieldsAll(ByRef sTableName)
Lists all fields in a table.

Returns

ArrayEx

getTableFieldsBase

Public Function getTableFieldsBase(ByRef sTableName)

Lists fields in a table excluding

"id", "timestamp_created", "timestamp_updated", "user_created", "user_updated".

Returns

ArrayEx

recordCommit

Public Function recordCommit(
ByVal sInputTable,
ByVal oInputRecord)
Commits a record to a table in the database, requires table name and the record. Database table requires following fields: "id"(INT AUTONUMBER), "timestamp_created"(DATETIME), "timestamp_updated"(DATETIME), "user_created"(VARCHAR), "user_updated(VARCHAR)"

Returns

ObjectEx

recordDelete

Public Function recordDelete(
ByVal sInputTable,
ByVal oInputRecord)
Deletes a record from a table in the database, requires table name and the record or record id.

Returns

BooleanEx

recordDiscover

Public Function recordDiscover(
ByVal sInputTable,
ByVal oInputRecord)
Selects a record (only the id) from a table in the database, requires table name and the record with lookup values.

Returns

ObjectEx

recordDiscoverExists

Public Function recordDiscoverExists(
ByVal sInputTable,
ByVal oInputRecord)
Determines if a record exists in a table in the database, requires table name and the record with lookup values.

Returns

ObjectEx

recordDiscoverLike

Public Function recordDiscoverLike(
ByVal sInputTable,
ByVal oInputRecord)
Selects a record (only the id) from a table in the database, requires table name and the record with lookup values.

Returns

ObjectEx

recordDiscoverLikeSelect

Public Function recordDiscoverLikeSelect(
ByVal sInputTable,
ByVal oInputRecord)
Selects a record from a table in the database, requires table name and the record with lookup values.

Returns

ObjectEx

recordDiscoverSelect

Public Function recordDiscoverSelect(
ByVal sInputTable,
ByVal oInputRecord)
Selects a record from a table in the database, requires table name and the record with lookup values.

Returns

ObjectEx

recordDiscoverSelectFields

Public Function recordDiscoverSelectFields(
ByVal sInputTable,
ByVal oInputRecord,
ByVal oInputFields)
Selects a record from a table in the database, requires table name and the record with lookup values.

Returns

ObjectEx

recordExists

Public Function recordExists(
ByVal sInputTable,
ByVal oInputRecord)
Determines if a record exists in a table in the database, requires table name and the record or record id.

Returns

BooleanEx

recordSelect

Public Function recordSelect(
ByVal sInputTable,
ByVal oInputRecord)
Selects a record from a table in the database, requires table name and the record or record id.

Returns

ObjectEx

recordSelectFields

Public Function recordSelectFields(
ByVal sInputTable,
ByVal oInputRecord,
ByVal oInputFields)
Selects specific fields in a record from a table in the database, requires table name and the record or record id.

Returns

ObjectEx

sqlExecute

Public Function sqlExecute(ByVal sInputSql)
Executes sql against the database and returns boolean.

Returns

BooleanEx

sqlExecuteAsync

Public Function sqlExecuteAsync(ByVal sInputSql)
Executes sql against the database asynchronously.

Returns

UndefinedEx

sqlExecuteEx

Public Function sqlExecuteEx(ByVal sInputSql)
Executes sql against the database and returns boolean.

Returns

BooleanEx

sqlQuery

Public Function sqlQuery(ByVal sInputSql)
Executes sql against the database and returns the result set.

Returns

ArrayEx

sqlQueryToCsvFile

Public Function sqlQueryToCsvFile(
ByVal sInputSql,
ByVal sFilePath,
ByVal sCharset)
Executes sql against the database and writes the result to a csv file.

Returns

Recordset

sqlQueryToRecordset

Public Function sqlQueryToRecordset(ByVal sInputSql)
Executes sql against the database and returns the result set as a recordset object.

Returns

Recordset

toBencode

Public Function toBencode()
Returns a Bencoded string representation of the object.

Returns

String

Example

		
	  Response.Write DatabaseEx("").toBencode()
	  

Output

0:

toJSON

Public Function toJSON()
Returns a json encoded string representation of the object.

Returns

String

Example

		
	  Response.Write DatabaseEx("").toJSON()
	  

Output

null

toString

Public Function toString()
Returns a string representation of the object.

Returns

StringEx

toXML

Public Function toXML()
Returns an XML encoded string representation of the object.

Returns

String

Example

		
	  Response.Write DatabaseEx("").toXML()
	  

Output

<data type="Null"/>

writeJSON

Public Sub writeJSON()
Writes a json encoded string representation of the object.

Returns

N/A

Example

		
	  Call DatabaseEx("").writeJSON()
	  

Output

null

writeXML

Public Sub writeXML()
Writes an XML encoded string representation of the object.

Returns

N/A

Example

		
	  Call DatabaseEx("").writeXML()
	  

Output

<data type="Null"/>

'***ClassicASP.org
'Copyright 2010 ClassicASP.org

'This file is part of ClassicASP Framework.

'ClassicASP-Framework is free software: you can redistribute it and/or modify
'it under the terms of the GNU General Public License as published by
'the Free Software Foundation, version 3 of the License.

'ClassicASP-Framework is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'GNU General Public License for more details.

'You should have received a copy of the GNU General Public License
'along with ClassicASP-Framework. If not, see .

'For additional information please visit .

Created with TwinText