beautypg.com

Database access functions, Mmdb.getcolumnandtypelist() – Adobe Dreamweaver API Reference CS5 User Manual

Page 72

background image

67

DREAMWEAVER API REFERENCE

The database API

Last updated 8/27/2013

Database access functions

Database access functions let you query a database.

In accessing database information, you can, for example, retrieve metadata that describes the schema or structure of a
database. This metadata includes information such as the names of tables, columns, stored procedures, and views. You
can also show the results of executing a database query or stored procedure. When accessing a database through this
API, you use structured query language (SQL) statements.

For the collection of functions that manage a database connection, see “

Database connection functions

” on page 55.

The following list describes some of the arguments that are common to the functions that are available:

Most database access functions use a connection name as an argument. You can see a list of valid connection names
in the Connection Manager, or you can use the

MMDB.getConnectionList()

function to get a list of all the

connection names programmatically.

Stored procedures often require parameters. You can specify parameter values for database access functions in two
ways. First, you can provide an array of parameter values (

paramValuesArray

). If you specify only parameter

values, the values must be in the sequence in which the stored procedure requires the parameters. Second, you
specify parameter values to provide an array of parameter names (

paramNameArray

). You can use the

MMDB.getSPParamsAsString()

function to get the parameters of the stored procedure. If you provide parameter

names, the values that you specify in

paramValuesArray

must be in the sequence of the parameter names that you

specify in

paramNameArray.

MMDB.getColumnAndTypeList()

Availability
Dreamweaver UltraDev 1.

Description
This function gets a list of columns and their types from an executed SQL

SELECT

statement.

Arguments
connName, statement

The connName argument is a connection name that is specified in the Connection Manager. It identifies the
connection string that Dreamweaver should use to make a database connection to a live data source.

The statement argument is the SQL

SELECT

statement to execute.

Returns
An array of strings that represents a list of columns (and their types) that match the

SELECT

statement, or an error if

the SQL statement is invalid or the connection cannot be made.

Example
The code

var columnArray = MMDB.getColumnAndTypeList("EmpDB","Select * from Employees")

returns

the following array of strings: