Delphi-RAG-Lint

drag-lint help

FIB$ reader inventory

Since: 1.61.0-alpha

Every routine that still names a FIB$ table or generator, classed SQL read / write, pipe load, name or message, from the project index.

Read this when you move a project off the FIBPlus FIB$ registry tables (FIB$FIELDS_INFO, FIB$DATASETS_INFO, FIB$ENUMVALUES, ...) onto the field repository and need the list of places to switch. drag-lint repo fib-readers --db <project index> searches the index text for FIB$ in .pas, .dfm and .sql, gives each hit one class (write, read, pipe, name, message; comments as mention only with --all) and groups the hits per routine, with the FIB$ names and lines. Read-only; --json for tools, --output to write a file.

How to run it

drag-lint repo fib-readers (--db <index> | --project <project file>) [--all] [--json] [--output <file>]

Full flag list: repo in the CLI reference.

Flags

FlagArgumentMeaningDefault
--db<index>
--project<project file>
--all
--json
--output<file>

Where to click

No IDE surface: this feature runs from the CLI (see How to run it).

Details

drag-lint repo fib-readers (--db <project index> | --project <project file>) [--all] [--json] [--output <file>]

Lists every routine of a project that still names a FIB$ object (the FIBPlus registry tables FIB$FIELDS_INFO, FIB$DATASETS_INFO, FIB$ENUMVALUES, FIB$ERROR_MESSAGES, their generators, ...) and says HOW it names it. It is the work list for moving a project off the FIB$ tables onto the field repository: each reader is a place to switch.

It asks the PROJECT index (not the field repository): the same text search as drag-lint query --text "FIB$" --substring, once for .pas, .dfm and .sql text. Nothing is written; the index is opened read-only.

Classes

Each hit gets ONE class, tested in this order (case-insensitive; SQL verbs as whole words, so UPDATE_TABLE_NAME is not an UPDATE):

ClassWhen
mentionthe hit is a comment or /// doc comment -- listed only with --all
pipeTABLE=FIB$... (a pipe table-load spec)
writeINSERT, UPDATE, DELETE or MERGE in the same text
readSELECT
messageprose: three or more words with a lower-case letter besides the FIB$ names (an error or log text, also Cannot Load from FIB$X)
readFROM / JOIN followed by FIB$ (an upper-case SQL line of a multi-line statement)
nameanything else: a table or generator name, a DFM TableName, GEN_ID(FIB$...)

Hits are grouped per file + routine (for a .dfm the component path and property, FbForm.tblFields.TableName; <unit> outside any routine). A reader carries every class of its hits, the FIB$ names (upper case, sorted) and the lines. A name glued to an identifier (PK_FIB$X) and a bare FIB$ are not object names.

Output

Text, one line per reader, then a summary that counts readers having each class:

uFbReaderA.pas:21  uFbReaderA.TReaderA.LoadSql  read  FIB$FIELDS_INFO
uFbReaderA.pas:26  uFbReaderA.TReaderA.SaveSql  write  FIB$FIELDS_INFO
readers: 2 (write 1, read 1, pipe 0, name 0, message 0, mention 0)

--json: one object

{"readers":[{"file":"...","routine":"...","line":21,"lines":[21],"hits":1,"classes":["read"],"tables":["FIB$FIELDS_INFO"]}],
 "counts":{"readers":1,"write":0,"read":1,"pipe":0,"name":0,"message":0,"mention":0},"capped":false}

--output <file> writes the report to the file instead of stdout. Each source is searched with a cap of 5000 hits; a source that reaches it adds the line capped ("capped":true): the list may be short.

Limits

  • Text only. A routine that reaches a FIB$ table through an object with no FIB$ literal (a generated data service resolved by DI, a TFDTable opened by a name built at run time) is not listed; its data service is.
  • A multi-line SQL built with SQL.Add is one hit per line: the FROM FIB$X line is a read, the other lines carry no FIB$ and are not seen.
  • The index must be fresh: reindex after editing, or the list is the old one.
ExitMeaning
0answered (also when nothing names FIB$)
1the index is missing or cannot be read, or the sqlite3.dll has no FTS5 trigram search
2neither --db nor --project

Tests: tests\autotest\run_v161_FIBINV.ps1 (classifier unit tests K1-K7 and the verb on the fixture tests\fixtures\v161\FIBINV: one reader per class, a mention only with --all, a clean unit never listed, the index unchanged).


All features | CLI reference | IDE menus