The Borland Database Engine (BDE) has been deprecated, so it will not be enhanced. For instance, BDE will never have Unicode support. You should not undertake new development with BDE. Consider migrating your existing database applications from BDE to dbExpress.
Name |
Description |
Active is a Boolean property that determines if database and dataset components associated with a session are open. You can use this property to read the current state of a session's database and dataset connections, or to change it. If Active is False (the default), all databases and datasets associated with the session are closed. If True, databases and datasets are open. A session is activated when it is first created, and subsequently, whenever its Active property is changed to True from False (for example, when a database or dataset is associated with a session is opened and there... more | |
You can create sessions to supplement the default session. At design time, you can place additional sessions on a data module (or form), set their properties in the Object Inspector, write event handlers for them, and write code that calls their methods. You can also create sessions, set their properties, and call their methods at runtime. Note: Creating additional sessions is optional unless an application runs concurrent queries against a database or the application is multi-threaded. | |
You can use two session component properties, Databases and DatabaseCount, to cycle through all the active database components associated with a session. Databases is an array of all currently active database components associated with a session. DatabaseCount is the number of databases in that array. As connections are opened or closed during a session's life-span, the values of Databases and DatabaseCount change. For example, if a session's KeepConnections property is False and all database components are created as needed at runtime, each time a unique database is opened, DatabaseCount increases by one. Each time a unique database is closed,... more | |
To open a database connection within a session, call the OpenDatabase method. OpenDatabase takes one parameter, the name of the database to open. This name is a BDE alias or the name of a database component. For Paradox or dBASE, the name can also be a fully qualified path name. For example, the following statement uses the default session and attempts to open a database connection for the database pointed to by the DBDEMOS alias: | |
Use a session's FindDatabase method to determine whether a specified database component is already associated with a session. FindDatabase takes one parameter, the name of the database to search for. This name is a BDE alias or database component name. For Paradox or dBASE, it can also be a fully-qualified path name. FindDatabase returns the database component if it finds a match. Otherwise it returns nil. The following code searches the default session for a database component using the DBDEMOS alias, and if it is not found, creates one and opens it: | |
Two session component properties, NetFileDir and PrivateDir, are specific to applications that work with Paradox tables. NetFileDir specifies the directory that contains the Paradox network control file, PDOXUSRS.NET. This file governs sharing of Paradox tables on network drives. All applications that need to share Paradox tables must specify the same directory for the network control file (typically a directory on a network file server). Delphi derives a value for NetFileDir from the Borland Database Engine (BDE) configuration file for a given database alias. If you set NetFileDir yourself, the value you supply overrides the BDE configuration setting, so... more | |
You can retrieve information about a session and its database components by using a session's informational methods. For example, one method retrieves the names of all aliases known to the session, and another method retrieves the names of tables associated with a specific database component used by the session. The following table summarizes the informational methods to a session component: Database-related informational methods for session components | |
To close an individual database connection, call the CloseDatabase method. When you call CloseDatabase, the reference count for the database, which is incremented when you call OpenDatabase, is decremented by 1. When the reference count for a database is 0, the database is closed. CloseDatabase takes one parameter, the database to close. If you opened the database using the OpenDatabase method, this parameter can be set to the return value of OpenDatabase. | |
Each database component associated with a session has a BDE alias (although optionally a fully-qualified path name may be substituted for an alias when accessing Paradox and dBASE tables). A session can create, modify, and delete aliases during its lifetime. The AddAlias method creates a new BDE alias for an SQL database server. AddAlias takes three parameters: a string containing a name for the alias, a string that specifies the SQL Links driver to use, and a string list populated with parameters for the alias. For example, the following statements use AddAlias to add a new alias for accessing an... more | |
A session's SessionName property is used to name the session so that you can associate databases and datasets with it. For the default session, SessionName is "Default," For each additional session component you create, you must set its SessionName property to a unique value. Database and dataset components have SessionName properties that correspond to the SessionName property of a session component. If you leave the SessionName property blank for a database or dataset component it is automatically associated with the default session. You can also set SessionName for a database or dataset component to a name that corresponds to the... more | |
If you create a single application that uses multiple threads to perform database operations, you must create one additional session for each thread. The BDE category on the Tool palette contains a session component that you can place in a data module or on a form at design time. Warning: When you place a session component, you must also set its SessionName property to a unique value so that it does not conflict with the default session's SessionName property. Placing a session component at design time presupposes that the number of threads (and therefore sessions) required by the application at... more | |
KeepConnections provides the default value for the KeepConnection property of implicit database components created at runtime. KeepConnection specifies what happens to a database connection established for a database component when all its datasets are closed. If True (the default), a constant, or persistent, database connection is maintained even if no dataset is active. If False, a database connection is dropped as soon as all its datasets are closed. Note: Connection persistence for a database component you explicitly place in a data module or form is controlled by that database component's KeepConnection property. If set differently, KeepConnection for a... more | |
If the KeepConnections property for a session is True (the default), then database connections for temporary database components are maintained even if all the datasets used by the component are closed. You can eliminate these connections and free all inactive temporary database components for a session by calling the DropConnections method. For example, the following code frees all inactive, temporary database components for the default session: | |
A session component can store passwords for password-protected Paradox and dBASE tables. Once you add a password to the session, your application can open tables protected by that password. Once you remove the password from the session, your application can't open tables that use the password until you add it again. | |
An BDE-based application's database connections, drivers, cursors, queries, and so on are maintained within the context of one or more BDE sessions. Sessions isolate a set of database access operations, such as database connections, without the need to start another instance of the application. All BDE-based database applications automatically include a default session component, named Session, that encapsulates the default BDE session. When database components are added to the application, they are automatically associated with the default session (note that its SessionName is "Default"). The default session provides global control over all database components not associated with another session, whether... more | |
You can use a session component to manage the database connections within it. The session component includes properties and methods you can use to
|
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|