XFA Specification
Chapter 11, Forms That Initiate Interactions with Servers
Invoking ADO APIs Through the Source Set DOM
343
the data base may be involved in different connections at the same time. It is up to the form creator to
understand the data base and ensure that such concurrent connections do not cause bad results.
Each
source
object has a
db
property which identifies the ADO object to which it connects. In the
example the target object is the
customer
database, which contains the
contacts
table.
The connect element
Each
source
element contains a single
connect
element. The
connect
element controls the
connection to the data base, but not interactions with the individual data records. The
connect
element
holds at most one
connectString
element, at most one
user
element, and at most one
password
element.
The connectString element
The value of
connectString
is arbitrary as far as XFA is concerned. The string is simply passed to the
data base server at connect time.
The user and password elements
The
user
and
password
elements are available so that the form can supply the required credentials for
logon automatically. Clearly there is a security risk in displaying the password in plain text! The password
should only be included if the form will have limited circulation. However, it is generally the case that ADO
is used only with a corporate LAN or WAN, not on the public Internet. If the user name and/or password
are omitted, and the data base requires one or both, the XFA application prompts the user to supply it or
them.
The command element
Each
source
element in the source set packet contains one or more
command
elements. In the example
there is just one command element, which has a
query
child.
The query element
A
query
element represents a method that maintains a cursor and a record set. The type and
characteristics of the cursor are determined by its contained
recordSet
element. The
query
element
also contains a
select
element and one or more
bind
elements.
The recordSet Element
The
recordSet
object in the source set DOM has many important properties. In the example the
recordSet
element is as follows:
<recordSet cursorType="static" cursorLocation="client"
lockType="optimistic" max="0"
bofAction="moveFirst" eofAction="moveLast"/>
The
cursorType
property causes a a
static
cursor to be used, which grabs a copy of the record set and
does not respond to subsequent changes by other users. Furthermore, updates to the record set are not
committed to the data base automatically. They are committed only when the
update
method of the
recordSet
object is invoked.
The
cursorLocation
property here causes the cursor to be located on the client. Where the cursor is
located affects the efficiency and responsiveness of the interaction. In this case, because the cursor type is
static
, it is desirable to maintain the cursor on the client.