User Guide

88 The Database API
Description
This function returns an array of objects that describe the columns in the specified table.
Arguments
connName, tableName
The connName argument is the connection name. This value identifies the connection
containing the string that Dreamweaver should use to make a database connection to a
live data source.
The tableName argument is the table to query.
Returns
An array of objects, one object for each column. Each object defines the following three
properties for the column with which it is associated.
Example
The following example uses MMDB.getColumns() to set the tooltip text value:
var columnNameObjs = MMDB.getColumns(connName,tableName);
var databaseType = MMDB.getDatabaseType(connName);
for (i = 0; i < columnNameObjs.length; i++)
{
var columnObj = columnNameObjs[i];
var columnName = columnObj.name;
var typename = columnObj.datatype;
if (dwscripts.isNumber(typename))
{
// it already is a num
typename = dwscripts.getDBColumnTypeAsString(typename,
databaseType);
}
var tooltiptext = typename;
}
Property Name Description
name
Name of the column (for example, price)
datatype
Data type of the column (for example, small money)
definedsize
Defined size of the column (for example, 8)
nullable Indicates whether the column can contain null values
000_DW_API_Print.book Page 88 Wednesday, July 20, 2005 11:58 AM