ZQuery

Generates a dataset with SQL statements and makes them available for processing using a TDataSource component. The visual components are in DataControls, for example the DBGrid. The data changes are transferred back to this and written to the database.

TSQLQuery von Lazarus ist nicht konform mit ZQuery, aber die Funktionsweise ist sehr ähnlich.. Der eine oder andere Tipp ist auch hier zu holen.

SqlDBHowto from Lazarus Wiki, a good introduction to working with the database components. But remember, the components and properties are not the same for Zeos and Lazarus. As for the background information on database development with support for components in Lazarus, this text is very enlightening.

Properties

Active
If Active is set to True, then the connection to the database (table) is active. ZQuery. Active: = True is the same as ZQuery.Open. ZQuery. Active: = False is the same as ZQuery.Close.

AutoCalcFields
The AutoCalcFields property determines when OnCalcFields is called. If true, OnCalcFields is called in the following cases:

CachedUpdates
The data is kept in a cache of the program and can then be finally transferred to the database using ApplyUpdates and then calling CommitUpdates. CancelUpdates undoes changes and does not write to the database.

Connection
Connects to ZConnection (= database). Click on> far left to display the ZConnection Properties.

DataSource
For parameters of a query that are not already bound to values ​​at design time
the property DataSource of the query is checked. If DataSource is set and the name of the unbound parameter matches a column name in the specified DataSource, the current value is bound to the corresponding parameter. This capability enables applications to have linked queries.

FetchRow
As far as I could find out, this property is for pagination (numbering) of query results. For example, if FetchRow is set to 10, and a query has 1000 rows, 10 rows will be fetched if needed. (The SQL query for returning a current record has been updated or inserted- "RefreshSQL")

 

Filter
With filter, an SQL dataset could be filtered again, for example
zQuery.Filter: = 'NAME LIKE' + # 39 + 'Joh%' + # 39 '. I would prefer to include this in the SQL query right away.


Filtered
True uses the Filter filter, False does not.


IndexFieldNames

Field names can be used for indexing. These should correspond to an index in the table, otherwise the performance suffers.


LinkedFields
The field or fields of this table used as a link to the MasterFields of the parent table.


MasterFields
The field or fields of the parent table used as a link to the LinkedFields.


MasterSource
Refers to the parent table of a join of 2 tables, which are then linked to MasterFields (MasterSource fields) and LinkedFields (fields of the query itself)


Name
The name of the ZQuery component


Options

doAlignMaxRequiredWideStringFieldSize: Maximum WideString field size required
doAlwaysDetailResync:
always resynchronize
doCachedLobs:
execute lobs in cache
doCalDefaults:
Use default settings for Calc?
doDontSortOnPost:
Do not sort data while writing
doNoAlignDisplayWidth:
Do not align the width of the ad
doOemTranslate:
Oem perform translation
doPreferPrepared:
Prefer Prepared
doSmartOpen:
Use Smart Open
doUpdateMasterFirst:
First update the master

 

ParamChar
The identifier before the parameters. Is usually a colon and does not need to be changed.

 

ParamCheck
ParamCheck determines if the Params property is cleared and regenerated if the SQL property of the query changes at runtime. By default, ParamCheck is True. This ensures that the correct number of parameters are generated for the current SQL statement.

 

Params
When preparing a query, an array params for the parameters
a dynamic SQL statement. Params is a starting zero-indexed array of TParam objects with one element per parameter of the query; the first parameter is Parms (0), the second params (1), and so on.
For example, suppose a ZQuery component named ZQuery1 has the
following SQL statement:
INSERT INTO ADDRESS (NAME, SURNAME, ...)
VALUES (: name,: Surname, ...)
Params can then be used to set the values ​​of the parameters such as
to specify below:

ZQuery1.Params(0).AsString := 'Johann';
ZQuery1.Params(1).AsString := 'Maier';
ZQuery1.Params(2).AsString := ...
These instructions use the value 'Johann' to the parameter: Name
bound, 'Maier' to the parameter: Surname.


Properties

Probably to set additional parameters, which are not included in the published Porperties.


ReadOnly

If True, the data can only be read but not changed.


Sequence

The component Sequence that is used for automatic numbering. TSequence is apparently no longer needed from Firebird 3 onwards.


SequenceField

The field that Sequence uses for automatic numbering.


ShowRecordTypes

SortedFields
If you want to sort by specific fields, they can be listed here.


SortType


SQL

Contains the text of the SQL statement to be executed by a query component. The property type is TStrings.


Tag

A Lazarus standard property for distinguishing components, and so on.


UpdateMode

UpdateObject
If ZQuery is connected to a ZUpdateSQL component, it is listed here.


WhereMode

 

Ereignisse

AfterApplyUpdates
When you call ApplyUdates to write the data to the database, AfterApplyUpdates is called after applying ApplyUpdates, and you can use your own program parts here.

AfterCancel
Will be triggered after a cancellation process.


AfterClose
Dispatched after the record has been closed


AfterDelete
Will be triggered after a successful deletion.


AfterEdit
Dispatched after the record has been placed in edit mode.


AfterInsert
Dispatched after the record has been placed in insert mode.


AfterOpen
Dispatched after the table has been opened.


AfterPost
Dispatched after changes have been written to the underlying database.


AfterRefresh
Will be triggered after a refresh


AfterScroll
Dispatched after the cursor has changed position.


BeforeApplyUpdates
Dispatched before ApplyUpdates is called.


BeforeCancel
Will be triggered before a cancellation process


BeforeClose
Dispatched before the table / query is closed.


BeforeDelete
Is triggered before a deletion.


BeforeEdit
Dispatched before putting the record into edit mode.


BeforeInsert
Dispatched before the record is put into insert mode.


BeforeOpen
Dispatched before a table / query is opened.


BeforePost
Called before changes are uploaded to the database.


BeforeRefresh
Dispatched before the Refresh command is executed.


BeforeScroll
Dispatched before the cursor changes position.


OnApplyUpdateError
Dispatched when ApplyUpdate fails.


OnCalcFields
Dispatched when calculating computed field values.


OnDeleteError
Dispatched when a deletion fails.


OnEditError
Dispatched when an editing operation fails.


OnFilterRecord
Triggered while filtering records.


OnNewRecord
Dispatched when a new record is created.


OnPostError
Dispatched when a post operation fails.


OnUpdateRecord
Dispatched when an update is issued.

<>

 

 

© CMBasic.de