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.
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.
The AutoCalcFields property determines when OnCalcFields is called. If true, OnCalcFields is called in the following cases:
- The dataset will be opened.
- The focus changes from one visual component to another.
- In a DBDataGridFocus component, from one column to another.
- A record is retrieved from the database.
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.
Connects to ZConnection (= database). Click on> far left to display the ZConnection Properties.
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.
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")
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.
True uses the Filter filter, False does not.
Field names can be used for indexing. These should correspond to an index in the table, otherwise the performance suffers.
The field or fields of this table used as a link to the MasterFields of the parent table.
The field or fields of the parent table used as a link to the LinkedFields.
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)
The name of the ZQuery component
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
The identifier before the parameters. Is usually a colon and does not need to be changed.
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.
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.
Probably to set additional parameters, which are not included in the published Porperties.
If True, the data can only be read but not changed.
The component Sequence that is used for automatic numbering. TSequence is apparently no longer needed from Firebird 3 onwards.
The field that Sequence uses for automatic numbering.
If you want to sort by specific fields, they can be listed here.
- stAscending: Data is sorted in ascending order
- stDescending: Data is sorted in descending order
- stIgnored: The sorting is ignored
Contains the text of the SQL statement to be executed by a query component. The property type is TStrings.
A Lazarus standard property for distinguishing components, and so on.
If ZQuery is connected to a ZUpdateSQL component, it is listed here.
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.
Will be triggered after a cancellation process.
Dispatched after the record has been closed
Will be triggered after a successful deletion.
Dispatched after the record has been placed in edit mode.
Dispatched after the record has been placed in insert mode.
Dispatched after the table has been opened.
Dispatched after changes have been written to the underlying database.
Will be triggered after a refresh
Dispatched after the cursor has changed position.
Dispatched before ApplyUpdates is called.
Will be triggered before a cancellation process
Dispatched before the table / query is closed.
Is triggered before a deletion.
Dispatched before putting the record into edit mode.
Dispatched before the record is put into insert mode.
Dispatched before a table / query is opened.
Called before changes are uploaded to the database.
Dispatched before the Refresh command is executed.
Dispatched before the cursor changes position.
Dispatched when ApplyUpdate fails.
Dispatched when calculating computed field values.
Dispatched when a deletion fails.
Dispatched when an editing operation fails.
Triggered while filtering records.
Dispatched when a new record is created.
Dispatched when a post operation fails.
Dispatched when an update is issued.