CGI Framework TDBTagInterpreter reference |
||||||||||||||||||||
![]() |
![]() |
TDBTagInterpreter reference TDBTagInterpreter is descendant of TTagInterpreter (to be precise a descendant of TCustomTagInterpreter) and includes tags for database processing and integration. Unit PBDb Description DBTagIntrepreter publishes nothing and not even have a icon on the pallete. It's kinda an abstract class. It is just a base class, being completely agnostic about the database or the access method you will use on your project. DBTagInterpreter understands tags to create "datasets". As in Delphi terminology, datasets are sources of data supplied by a database. In PBTagInterpreter, a dataset is always defined by a SQL SELECT statement. DBTagIntrepreter internally initializes NameSpace property to "db". It means, by default, a PBTagInterpreter will process every tag started with "db:", but, programaticaly, in run-time you can change the namespace to whatever you want. You will never instantiate TDBTagInterpreter directly. You will instantiate one of its descendants. In the current version the only one is TDBIbxTagInterpreter, for accessing Interbase database through the IBX components. constructor Create ( pOwner: TComponent ) After calling the inherited method, Create initialize NameSpace to 'db' and creates internal storage for the repository of datasets. destructor Destroy After releasing internal storage, Destroy calls the inherited method.
procedure Clear Clears internal storage, closing every open dataset.
property Repository: TPBDbRepository Allow access to internal dataset storage. You can add, remove or change datasets programaticaly in run-time through that property.
Repository is a list (a TObjectList descendant, to be precise) of TPBDbRepoitoryItem. Every PBDbRepoitoryItem have a name, a dataset, a datasource and a tag interpreter property. Pre-defined Tags A DBTagInterpreter is prepared to process some pre-defined tags. The complete set of tags includes: db:dataset, db:browse, db:list and db:fieldvalue. Tag db:dataset
db:dataset defines and stores a dataset in the repository. The dataset is created by a overrided internal method. The overrided method must create a descendant of TDataset appropriate to the database being used. The dataset remains active (open) for the remaining process of tag substitution. db:dataset may be a simple tag or a compound one. You can write others db:dataset tag inside it. Embedding a db:dataset inside another db:dataset have a special meaning: the inner db:dataset is a "slave" of the outer db:dataset. It means you can use SQL parameters in the inner db:dataset and Delphi/Kylix will supply proper values to these parameters from fields with the same name on the "master" table. At your choice, you can determine the master-slave relationship explicitly, by including a "master" attribute. The master value must be the name value of a previously defined dataset. Inside a db:dataset, any tag content that is not another db:dataset will be discarded. Tag db:browse
db:browse allows interaction over a previously defined dataset. Usually db:browse tag contents will include one or more db:fieldvalue tags. It's also possible to include a db:browse inside another. Normally the inner db:browse will interact over a slave dataset and the outer one over the master. As db:browse interacts over all the records in the specified dataset, its tag contents gets replicated for every fetched record. If a delim attribute is supplied, the delim value will be included between every replication produced. If a lastDelim is supplied, it will be used just before the last content replication, given at last two replications occurs. Tag db:list
db:list allows interaction over a dataset much like db:browse do. The difference is db:list is a simple tag. In the db:list execution, the replicated content will be the value for the given field. On db:list, the behavior of delim and lastDelim is the same as in db:browse. Tag db:fieldvalue Syntax: <db:fieldvalue dataset="aDatasetName" field="aFieldName"/> db:fieldvalue is replaced with the textual representation of a field whose name is given. The field must come from a pre-defined dataset. Normally db:fieldvalue is used on a db:browse tag content, and, for each db:browse interaction it gets replaced by the current record field value. When used outside a db:browse, the current record will be the first record when no db:browse occurred yet or the last dataset record when at lest one db:browse was performed. |
![]() |
|||||||||||||||||
![]() |
||||||||||||||||||||
Copyleft (2002) Ivan C. Cruz Site contents may be reproduced in all or in part since you provide a clear statement citing that site as your source. That site was built and tested with Mozilla. If some components looks misalligned or not properly rendered, it may be your browser fault. In that case, please, consider an upgrade. |