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

Getting database information

Читайте также:
  1. A) Answer the questions and then compare your answers with the information given below.
  2. A-4: Learned schematic information
  3. Additional information
  4. Answer the questions using the information from the text.
  5. Asking for Further Information
  6. Asking for information
  7. BRIEF THEORETICAL INFORMATION

TSession has a number of methods that enable an application to get database-relatedinformation. Each method takes a TStrings component as its parameter and returns into a TStrings the specified information:

Table 3.1 TSession methods

Method Returns
GetAliasNames Defined BDE alias names.
GetAliasParams Parameters for the specified BDE alias.
GetDatabaseNames Database names and BDE aliases defined.
GetDriverNames Names of BDE drivers installed.
GetDriverParams Parameters for the specified BDE driver.
GetTableNames All table names in the specified database.

 

For more information on these methods, see the online VCL Reference.

 

Lecture 10. Using datasets

 

TTable and TQuery component classes are descended from TDataSet through TDBDataSet. These component classes share a number of inherited properties, methods,and events. For this reason, it is convenient to refer to them together as datasets, when the discussion applies to both TTable and TQuery.

This section describes the features of datasets that are common to TTable and TQuery. A subsequent section discusses features unique to TTable.

 

Note TStoredProc is also a dataset component since it is descended from TDBDataset. Therefore, much of this section also applies to TStoredProc if the stored procedure returns a result set rather than a singleton result.

 

Dataset states

Table 3.2. Dataset states

State Description
Inactive The dataset is closed.
Browse The default state when a dataset is opened. Records can be viewed but not changed or inserted.
Edit Enables the current row to be edited.
Insert Enables a new row to be inserted. A call to Post inserts a new row.
SetKey Enables FindKey, GoToKey, and GoToNearest to search for values in database tables. These methods only pertain to TTable components. For TQuery, searching is done with SQL syntax
CalcFields Mode when the OnCalcFields event is executed; prevents any changes to fields other than calculated fields. Rarely used explicitly.

 

A dataset can be in the following states, also referred to as modes:

An application can put a dataset into most states by calling the method corresponding to the state. For example, an application can put Table1 in Insert state by calling Table1.Insert or Edit state by calling Table1.Edit. A number of methods return a dataset to Browse state, depending on the result of the method call. A call to Cancel will always return a dataset to Browse state.

CalcFields mode is a special case. An application cannot explicitly put a dataset into CalcFields mode. A dataset automatically goes into CalcFields mode when its OnCalcFields event is called. In OnCalcFields, an exception will occur if an applicationattempts to assign values to non-calculated fields. After the completion of OnCalcFields, the dataset returns to its previous mode.

The following diagram illustrates the primary dataset states and the methods that cause a dataset to change from one mode to another.

 

Figure 3.2 Dataset state diagram

 

The State property specifies the current state of a dataset. The possible values correspond to the above states and are dsInactive, dsBrowse, dsEdit, dsInsert, dsSetKey, and dsCalcFields.

The OnStateChange event of TDataSource is called whenever the state of a data source’s dataset changes.


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


Читайте в этой же книге: 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 |
<== предыдущая страница | следующая страница ==>
Controlling database connections| Database application development cycle

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