Delphi-RAG-Lint
Delphi tooling · Field Repository

A Master File for Your Field Metadata

The Field Repository keeps the field facts of a Delphi and Firebird project in one SQLite file, drag-lint 1.61 carries grid bands and layout groups from that file into your forms, and releases expected within the next two to three weeks are planned to feed the IDE and lookup fields from it. This article shows what ships today with real output, and marks every planned item as planned. Update, 2026-12-01: 1.62 shipped the table description and the lookup resolver; section 05 marks them.

Shipped and planned

Sections 01 to 04 describe drag-lint 1.61.0-alpha, released 2026-11-30. Section 05 was a plan when written; drag-lint 1.62.0-alpha (2026-12-01) shipped part of it, marked there. The rest is still planned, and its details may change. The output in section 02 is real output of 1.61.0-alpha on a one-form fixture (paths shortened to ...).

We are building the Field Repository for Micronite, the Delphi and Firebird application we develop as quality and production-control software for manufacturers. In a project like that the same facts about a field turn up in many places: its caption, display width and calculated-field code in the form files, its event code in handlers, its column layout in each grid, and more of the same in metadata tables inside the database. When one of them changes, the others drift.

01 — What it is

One SQLite file per database

The repository is a single .dlrepo file, one per database, separate from the code index. Tools read from your database and your forms into it, and write from it back into forms and units. drag-lint only reads Firebird; the one exception is a table change you ask for explicitly with repo alter-table, and that runs only after a verified backup.

A new repository is at schema 7 in 1.61 and holds these tables:

drag-lint repo init --repo orders.dlrepo
drag-lint repo info --repo orders.dlrepo
repository: ...\orders.dlrepo
schema_version: 7
DL_META: 1 rows
DL_FIELDS_INFO: 0 rows
DL_DATASETS_INFO: 0 rows
DL_ENUMVALUES: 0 rows
DL_ERROR_MESSAGES: 0 rows
DL_LAYOUT_EVENTS: 0 rows
DL_EXCEPTIONS: 0 rows
DL_DOMAINS: 0 rows
DL_CONSTRAINTS: 0 rows
DL_CONSTRAINT_COLUMNS: 0 rows
DL_GENERATORS: 0 rows
DL_GRID_COLUMNS: 0 rows
DL_RELATIONS: 0 rows
DL_RELATION_COLUMNS: 0 rows
DL_FIELD_INPUTS: 0 rows
DL_GRID_CONTAINERS: 0 rows
meta schema_version: 7

DL_GRID_CONTAINERS is new in schema 7: it holds the bands of a banded view and the groups of a layout view. Every command that writes prints its change set first. Without --apply, or --select with the ids you picked, it is a dry run, and the repository and each form get a backup before the first write.

02 — A real run

A banded grid layout, from one form into another

The fixture is a small form from drag-lint’s own tests: frmPlace, with a memory table on an ORDERS table (ID, QTY, NOTE) and a TcxGridDBBandedTableView named bvOrders. Copy A of the form has the layout we want: an Order band with ID, and a Details band with QTY and NOTE. Copy B is the same form before the Details band was added: one band, one column. The repository was filled from a three-column DDL script with repo seed-fb.

Step 1. Read the view of copy A into the repository:

drag-lint repo read-grid --dfm A\uGridPlace.dfm --from bvOrders --repo orders.dlrepo --apply
view bvOrders (TcxGridDBBandedTableView) dataset memOrders -> ORDERS: 3 columns
  [0] bvOrdersID field ID
  [1] bvOrdersQTY field QTY
  [2] bvOrdersNOTE field NOTE
# plan 35fddd481bf73571
direction dfm-to-repo, 5 changes, 0 blocked, 0 unchecked
[1] insert DL_GRID_COLUMNS frmPlace|bvOrders|bvOrdersID:  -> TABLE_NAME=ORDERS; FIELD_NAME=ID; COLUMN_INDEX=0; VIEW_CLASS=TcxGridDBBandedTableView; CAPTION=Id; WIDTH=40; CONTAINER_NAME=Band0; ROW_INDEX=0; COL_INDEX=0
[2] insert DL_GRID_COLUMNS frmPlace|bvOrders|bvOrdersQTY:  -> TABLE_NAME=ORDERS; FIELD_NAME=QTY; COLUMN_INDEX=1; VIEW_CLASS=TcxGridDBBandedTableView; CAPTION=Qty; WIDTH=60; CONTAINER_NAME=Band1; ROW_INDEX=0; COL_INDEX=0
[3] insert DL_GRID_COLUMNS frmPlace|bvOrders|bvOrdersNOTE:  -> TABLE_NAME=ORDERS; FIELD_NAME=NOTE; COLUMN_INDEX=2; VIEW_CLASS=TcxGridDBBandedTableView; CAPTION=Note; WIDTH=240; CONTAINER_NAME=Band1; ROW_INDEX=0; COL_INDEX=1
[4] insert DL_GRID_CONTAINERS frmPlace|bvOrders|Band0:  -> CONTAINER_KIND=band; CONTAINER_INDEX=0; CAPTION=Order; WIDTH=200
[5] insert DL_GRID_CONTAINERS frmPlace|bvOrders|Band1:  -> CONTAINER_KIND=band; CONTAINER_INDEX=1; CAPTION=Details; WIDTH=300
applied: 5 changes

Each column is stored under its form, view and column name, with its caption, width, band, row and position in the band. The two bands are stored as containers.

Step 2. Ask what copy B lacks. --dry-run writes nothing; so does the same command without --apply:

drag-lint repo write-grid --dfm B\uGridPlace.dfm --unit B\uGridPlace.pas --to bvOrders --repo orders.dlrepo --dry-run
# plan 5a3084f6eccc414f
write-grid ORDERS -> bvOrders (TcxGridDBBandedTableView) in uGridPlace.dfm: 2 changes, 0 blocked
direction repo-to-dfm, 2 changes, 0 blocked, 0 unchecked
[1] insert uGridPlace.dfm bvOrdersQTY:  -> TcxGridDBBandedColumn QTY in Band1
[2] insert uGridPlace.dfm bvOrdersNOTE:  -> TcxGridDBBandedColumn NOTE in Band1
dry run: nothing written (add --apply, or --select <file> with the # plan line and the ids, to write)

Step 3. The same command with --apply writes the form and the unit. These are the changed parts of the form file: the Order band item was there before, and ... stands for unchanged lines. The Details band did not exist in copy B, so it was created:

      Bands = <
        item
          Caption = 'Order'
          Width = 200
        end
        item
          Caption = 'Details'
          Width = 300
        end>
      ...
      object bvOrdersQTY: TcxGridDBBandedColumn
        Caption = 'Qty'
        DataBinding.FieldName = 'QTY'
        Width = 60
        Position.BandIndex = 1
      end
      object bvOrdersNOTE: TcxGridDBBandedColumn
        Caption = 'Note'
        DataBinding.FieldName = 'NOTE'
        Width = 240
        Position.BandIndex = 1
        Position.ColIndex = 1
      end

The unit gets the two column declarations in the form class. Every other byte of both files stays as it was, and the new form text is checked by the Delphi form reader before it is written. A second run has nothing to do:

direction repo-to-dfm, 0 changes, 0 blocked, 0 unchecked
NOTE: bvOrders has a column for every field and entry of ORDERS already

A TcxGridDBLayoutView works the same way: the layout groups are stored as containers, a new item goes into its group, and a missing group is created. write-grid only adds. A column the grid already has is never changed, and nothing is deleted.

03 — Also in 1.61

Generated handlers, lookup fields and an inventory

  • repo gen-calc writes the stored calculated-field bodies of a dataset into one region of its OnCalcFields handler, in dependency order, with the field macros expanded. A calculation cycle is refused.
  • repo gen-events turns stored column event code (OnGetDisplayText, OnCustomDrawCell, OnGetDataText, OnGetProperties, OnGetCellHint) into a new handler in the form unit and assigns the event in the form file, for table, banded and layout views. An event that is already assigned is reported, never replaced.
  • repo read-dfm and repo write-dfm keep lookup, calculated, internal-calculated and aggregate fields with their LookupDataSet, LookupCache and every other property the form states.
  • repo fib-readers lists every routine in the project index that names a FIB$ table or generator, classed as write, read, pipe, name or message. It is read-only.
  • In RAD Studio, drag-lint > Field Repository has two new commands: Generate Calculated-Field Handlers… and Generate Grid Column Events…

Both generators show their change set first and take --apply or --select, like write-grid.

Help: repo gen-calc · repo gen-events · repo fib-readers

04 — Upgrading

Move an existing repository to schema 7

Bands and layout groups need schema 7. A schema-6 repository, as made by 1.60, is refused for banded and layout views and still serves table views and TDBGrid. Move it up once:

drag-lint repo migrate --repo orders.dlrepo --apply

Without --apply it is a dry run that changes no byte. With it, a text backup <repo>.before-migrate-<date-time>.txt is written first. On a repository that is already at schema 7 it prints already at schema 7.

05 — Planned, and what 1.62 shipped

Expected within the next two to three weeks

Update, 2026-12-01: drag-lint 1.62 shipped several of the items below; each is marked “shipped in 1.62” with its help page. They are described from the 1.62 help and change log, not run for this article. Everything still marked planned is not released, and details may change.

Update, 2026-12-02: drag-lint 1.63 shipped repository schema 8 and two more pieces, marked “shipped in 1.63” below, from the 1.63 help and change log, not run for this article.

When this article was written, nothing in this section was released. These items come from our project plans: the first three were expected within the next two to three weeks, and the last after them.

Field lists for the designer, without a server (planned). We also build a grid-provider component for Delphi with an “Update columns” command in the designer: it adds missing columns and reports orphans, and never deletes. Today it learns the fields from a running server and applies only width and visibility, and its behaviour in the IDE is still being verified. The plan:

  • Shipped in 1.62. A read-only command that describes one table’s fields and their attributes, with the source of each value: drag-lint repo describe --table <T> (--repo <file> | --project <file>) [--form <F> --view <V>] [--kinds <list>] [--json]. Help.
  • Shipped in 1.62. A Pascal reader unit of the same contract for your own code, checked against the command by a parity test.
  • Still planned. A source for the provider that supplies the field list and per-field attributes, such as captions and widths, from the repository, with no server running. Updating columns stays add-only.
  • Shipped in 1.63. repo write-grid also writes into the provider’s own grid view, taking the table from the view’s key, and the provider’s designer can re-apply repository attributes to existing columns through a tabbed diff.

Where a lookup reads from (shipped in 1.62). repo lookup-source (help), the rule lookup-source-filtered (off by default) and repo gen-lookup-layer (help) implement what follows; the change log lists generated TFDTable / TFDQuery fallbacks for tiers one and two, and ORM3 units for the layer. As planned: the repository already stores which table a lookup field reads. The resolver finds which component in the project holds that table unfiltered at run time, proves it from the form properties and from the index (no code in the project changes its rows), and ranks the candidates. A filtered source is a warning, not a block, and you accept it with a reviewed dl:ok marker. When no component qualifies, the fallback depends on the project tier you declare (one, two or three layers): a generated TFDTable or TFDQuery, or a generated layer-interface unit backed by a server-side cache that preloads the lookup tables.

Filling an existing application’s repository (planned). A one-time import of an existing Firebird metadata set and the form labels, after which the repository is the single master. It is planned first for Micronite.

After those. Writing attributes back onto existing columns shipped in 1.62: repo write-grid --columns lists the differing properties of chosen columns as unticked changes, written only when you select them, also in the IDE diff dialog (help). Repository schema 8 shipped in 1.63: it adds column facts, index and enum tables and FIB$VERSION, which repo import-fb now fills, and repo gen-fib-consumer generates the code that reads one FIB$ table from the repository instead of from the database (help). A schema-8 file can no longer be opened by 1.61 or 1.62; keep the backup repo migrate --apply writes if an older engine must still read it.

06 — Why it is repeatable

A deterministic Delphi algorithm, not AI

Every step above parses text files and a SQLite file, compares them, prints a change set and applies only what you select. Nothing is guessed or filled in by a model; a property the form does not state is reported, not invented. The same inputs give the same change set every time, and drag-lint’s tests pin the output. The engine is written in Delphi.

07 — Limits

What to know before you rely on it

  • Columns are stored under form, view and column name. A band position is written only for a field whose column the repository holds for that view; in 1.61 a field with no stored column gets a new column without a Position line, so check where it lands in the designer. Since 1.62, by its change log, such a column is placed in a band instead.
  • write-grid and gen-events only add. Changing or removing an existing column or handler is your job, in the designer.
  • Bands and layout groups need a schema-7 repository (repo migrate --apply, section 04).
  • The items in section 05 marked planned are not released, and their details may change; the ones marked shipped in 1.62 are described from the 1.62 help, not run for this article.

Output measured 2026-11-30 with drag-lint 1.61.0-alpha on a one-form fixture from drag-lint’s tests (uGridPlace.dfm), with a second band added for copy A; the plan ids depend on the file paths. gen-calc, gen-events, fib-readers and the IDE commands are described from the 1.61 help and change log, not run for this article. Section 05 describes plans and, since 2026-12-01, which of them 1.62 shipped.