77
CHAPTER 7
The Database API
Functions in the Database API let you manage database connections and access information that
is stored in databases. The Database API is divided by two distinct purposes: managing and
accessing database connections.
In managing database connections, you can get the user name and password needed to make a
connection to a database, open up a database connection dialog box, and so on.
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.
Database API functions are used at design time when users are building web applications, not at
runtime when the web application is deployed.
You can use these functions in any extension. In fact, the Macromedia Dreamweaver MX 2004
Server Behavior, Data Format, and Data Sources API functions all use these database functions.
How Database API functions work
The following example shows how the server behavior function,
getDynamicBindings()
, is
defined for Recordset.js. This example uses the
MMDB.getColumnAndTypeList()
function:
function getDynamicBindings(ss)
{
var serverModel = dw.getDocumentDOM().serverModel.getServerName();
var bindingsAndTypeArray = new Array();
var connName = ss.connectionName;
var statement = ss.source;
var rsName = ss.rsName;
// remove SQL comments
statement = statement.replace(/\/\*[\S\s]*?\*\//g, " ");
var bIsSimple = ParseSimpleSQL(statement);
statement = stripCFIFSimple(statement);
if (bIsSimple) {
statement = RemoveWhereClause(statement,false);
} else {
var pa = new Array();
000_DW_API_Print.book Page 77 Wednesday, August 20, 2003 9:14 AM
Summary of Contents for DREAMWEAVER MX 2004-DREAMWEAVER API
Page 1: ...Dreamweaver API Reference...
Page 24: ...24 Contents...
Page 32: ......
Page 70: ...70 Chapter 5 Fireworks Integration...
Page 76: ...76 Chapter 6 Flash Integration...
Page 116: ...116 Chapter 9 The JavaBeans API...
Page 140: ......
Page 152: ...152 Chapter 11 Application...
Page 218: ...218 Chapter 12 Workspace...
Page 248: ...248 Chapter 13 Site...
Page 292: ...292 Chapter 14 Document...
Page 378: ...378 Chapter 17 Design...
Page 430: ...430 Chapter 18 Code...
Page 486: ...486 Index...