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
Содержание DREAMWEAVER MX 2004
Страница 1: ...Dreamweaver API Reference...
Страница 24: ...24 Contents...
Страница 32: ......
Страница 70: ...70 Chapter 5 Fireworks Integration...
Страница 76: ...76 Chapter 6 Flash Integration...
Страница 116: ...116 Chapter 9 The JavaBeans API...
Страница 140: ......
Страница 152: ...152 Chapter 11 Application...
Страница 218: ...218 Chapter 12 Workspace...
Страница 248: ...248 Chapter 13 Site...
Страница 292: ...292 Chapter 14 Document...
Страница 378: ...378 Chapter 17 Design...
Страница 430: ...430 Chapter 18 Code...
Страница 486: ...486 Index...