Студопедия
Случайная страница | ТОМ-1 | ТОМ-2 | ТОМ-3
АвтомобилиАстрономияБиологияГеографияДом и садДругие языкиДругоеИнформатика
ИсторияКультураЛитератураЛогикаМатематикаМедицинаМеталлургияМеханика
ОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРелигияРиторика
СоциологияСпортСтроительствоТехнологияТуризмФизикаФилософияФинансы
ХимияЧерчениеЭкологияЭкономикаЭлектроника

Controlling database connections

Читайте также:
  1. Build all the possible connections between the nouns and the surrounding verbs.
  2. CHAPTER XX SYNTAGMATIC CONNECTIONS OF WORDS
  3. Database application development cycle
  4. Database components architecture
  5. Delphi database architecture
  6. Delphi database architecture

Lecture 9. Using data access components and tools

 

This lecture provides an overview and general description of data access components in the context of application development. For in-depth reference information on database components, methods, and properties, see the online VCL reference.

 

Database components hierarchy

 

The Delphi database component hierarchy is important to show the properties, methods, and events inherited by components from their ancestors. The most important database components are

TSession, a global component created automatically at run time. It is not visible onforms either at design time or run time.

TDatabase, component that provides an additional level of control over server logins,transaction control, and other database features. It appears on the Data Access component page.

TDataSet and its descendents, TTable and TQuery, collectively referred to as datasetcomponents. TTable and TQuery components appear on the Data Access component page.

TDataSource, a conduit between dataset components and data-aware components. Itappears on the Data Access component page.

TFields, components corresponding to database columns, created either dynamicallyby Delphi at run time or at design time with the Fields Editor. Data controls use them to access data from a database. In addition, you can define calculated fields whose values are calculated based on the values of one or more database columns.

 

Figure 3.1 Delphi Data Access components hierarchy

 

This lecture describes most of these components and the tools that Delphi provides to work with them.

 

Using the TSession component

 

The TSession component is rarely used, but can be useful for some specialized purposes. Delphi creates a TSession component named “Session” each time an application runs. You cannot see nor explicitly create a TSession component, but you can use its methods and properties to globally affect the application.

Controlling database connections

TSession provides global control over database connections for an application. The Databases property of TSession is an array of all the active databases in the session. The DatabaseCount property is an integer specifying the number of active databases(TDatabase components) in the Session.

KeepConnections is a Boolean property that specifies whether to keep inactive databaseconnections. A database connection becomes inactive when a TDatabase component has no active datasets. By default, KeepConnections is True, and an application will maintain its connection to a database even if the connection is inactive. This is generally preferable if an application will be repeatedly opening and closing tables in the database. If KeepConnections is False, a database connection will be closed as soon as the connection is inactive. The DropConnections method will drop all inactive database connections.

The NetFileDir property specifies the directory path of the BDE network control directory. The PrivateDir property specifies the path of the directory in which to store temporary files (for example, files used to process local SQL statements). You should set this property if there will be only one instance of the application running at a time. Otherwise, the temporary files from multiple application instances will interfere with each other.


Дата добавления: 2015-10-23; просмотров: 134 | Нарушение авторских прав


Читайте в этой же книге: Sussex, 2nd September | Barn House, 19th January 1998 | Barn House, September 30 | Barn House, June 7, 1996 | Barn House, December 18, 1997 | Fir Tree Cottage, 6th April | Dorset, 11th August 1994 | Barn House, 4th March 1999 | Barn House, 18th April 1997 | Barn House, May 6, 1999 |
<== предыдущая страница | следующая страница ==>
Th September 2003| Getting database information

mybiblioteka.su - 2015-2024 год. (0.006 сек.)