Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Versions follow [Semantic Versioning](https://semver.org/).

### Changed

- Contributor guidance moved into `CONTRIBUTING.md`: SqlKata origin, generated
code, reference tests and XML documentation conventions. The porting log,
dated validation records and XML documentation audit (`docs/PORTING.md`,
`docs/VALIDATION.md`, `docs/XML_DOCUMENTATION.md`, the validation JSON files
and `tools/record_validation.py`) were removed; they remain in the v2.0.0 tag.
- The converter emits flat fluent chains for AND or OR sequences and nests a
callback only where the operator changes.
- Converter error messages quote the unsupported SQL fragment and suggest the
Expand Down Expand Up @@ -96,7 +101,7 @@ a documentation website with a browser-local SQL-to-Delphi converter.
### Validation

- Release checks and their scope are recorded in
[validation details](docs/VALIDATION.md#v200-release-validation-2026-10-31).
[validation details](https://github.com/auchri/QueryBuilder4Delphi/blob/v2.0.0/docs/VALIDATION.md#v200-release-validation-2026-10-31).
- Existing Delphi executables rerun: 940 Core and 94 FireDAC tests passed on
each of Win32 and Win64, with zero failures, errors, ignored tests or leaks.
These are reruns of the October 25 IDE builds, not fresh release builds.
Expand Down Expand Up @@ -148,7 +153,7 @@ Delphi 12 and later on Windows (Win32 and Win64).
- All four suites reported zero failures, errors, ignored tests or test leaks.
- Database integration was verified with SQLite in memory. Other dialects were
covered by SQL compilation and binding tests; server-specific execution was
not tested. See [validation details](docs/VALIDATION.md).
not tested. See [validation details](https://github.com/auchri/QueryBuilder4Delphi/blob/v1.0.0/docs/VALIDATION.md).

[Unreleased]: https://github.com/auchri/QueryBuilder4Delphi/compare/v2.0.0...HEAD
[2.0.0]: https://github.com/auchri/QueryBuilder4Delphi/releases/tag/v2.0.0
Expand Down
102 changes: 102 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Contributing

QueryBuilder4Delphi is a Delphi port of [SqlKata](https://github.com/sqlkata/querybuilder),
ported from SqlKata commit `df4a2377750d34fc057c81886b481e7309ef975e`. The
query model and SQL compilers follow SqlKata; execution, object mapping and
`TNullable<T>` are Delphi additions. Intentional differences from SqlKata are
listed in the [API reference](docs/API.md#additional-behavior-and-limitations).

## Build and test

Requirements: Delphi 12 or later for Win32 and Win64, Python 3 for the
generators and checks, and Node.js 24 for the website.

1. Open `QueryBuilder4Delphi.Tests.groupproj` and use **Project > Build All
Projects** for Win32 and Win64. It contains the core DUnitX tests and the
FireDAC/SQLite integration tests.
2. Run both suites on both platforms:

```powershell
./tools/build.ps1 -Suite Core -Platform Both -TestsOnly
./tools/build.ps1 -Suite FireDAC -Platform Both -TestsOnly
```

Without `-TestsOnly`, the script also compiles. That needs an edition with
command-line compilation; Community Edition builds only in the IDE.
3. Run the generator and documentation checks from the repository root:

```text
python tools/generate_query.py --check
python tools/generate_oracle.py --check
python tools/check_xml_documentation.py
python -m unittest discover -s tools -p "test_*.py"
```

Website and converter changes are described in
[Website maintenance](docs/WEBSITE.md), including the generated Delphi smoke
projects (`build/converter-smoke/ConverterSmoke.groupproj`).

Optional: [tools/format.ps1](tools/format.ps1) runs the Delphi formatter on
`src` and `test`, and [Mapping performance](docs/MAPPING_PERFORMANCE.md)
explains how to rerun the benchmarks.

## Generated code

Do not edit generated sections by hand; change the generator and rerun it.

- **Fluent wrappers.** [tools/generate_query.py](tools/generate_query.py)
writes the repetitive fluent declarations and implementations between
`BEGIN GENERATED` and `END GENERATED` markers in
`QueryBuilder4Delphi.Query.Core.pas` and `QueryBuilder4Delphi.Query.pas`.
Their XML documentation comes from
[tools/query_documentation.py](tools/query_documentation.py). Code outside
the markers is never touched.
- **Reference tests.** [tools/generate_oracle.py](tools/generate_oracle.py)
defines paired C# and Delphi scenarios. It writes `test/Oracle.Scenarios.pas`,
the DUnitX test cases and the C# program in `tools/oracle`.

`--check` compares tokens, including comments, without writing files.

## Reference results from SqlKata

`test/golden.json` holds SQL, raw SQL and bindings that the original C#
SqlKata produces for every scenario and dialect. The Delphi tests compare
against it, so the port stays faithful to SqlKata.

To add a scenario or refresh the results, clone SqlKata next to this
repository (as `../querybuilder`), then:

```text
python tools/generate_oracle.py ../querybuilder
dotnet run --project tools/oracle -- test/golden.json
```

Twelve combinations intentionally differ from SqlKata: HAVING callbacks and
Oracle aggregate aliases. They keep the unmodified C# output in
`golden.json`, are excluded from the direct comparison, and have dedicated
tests for the corrected behavior.

## XML documentation

Every exported declaration in `src` has Delphi XML documentation:

- `///` comments directly before the declaration, using `summary`, named
`param`, `returns` and, where useful, `remarks` and `exception cref`.
- Escape XML characters, including generic angle brackets; wrap at 110 columns.
- No C#-only tags such as `typeparam` or `inheritdoc`, and no Markdown.
- Each enum value has its own summary; the enum's summary also describes all
values.
- Describe behavior callers rely on: fluent mutation versus cloning,
parameterized output versus diagnostic previews, NULL handling, ownership.

`tools/check_xml_documentation.py` checks coverage, XML validity, the tag set
and that parameter names match each signature. It reads the declaration forms
used in this repository; it is not a full Delphi parser.

## Pull requests

- Add or update tests with every behavior change, and run the checks above.
- Note user-visible changes in [CHANGELOG.md](CHANGELOG.md) under
**Unreleased**.
- Keep `README.md` examples compiling: they are checked by
`test/DocumentationExamples.pas`.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,8 @@ After IDE builds, run:
```

Command-line builds through `tools/build.ps1` require an edition that supports
command-line compilation. [Validation notes](docs/VALIDATION.md) distinguish
compiled examples, compiler regression checks and actual database execution.
[Contributor and reference notes](docs/PORTING.md) cover generated code and test
provenance.
command-line compilation. See [Contributing](CONTRIBUTING.md) for generated
code, the SqlKata reference tests and documentation checks.

## License

Expand Down
5 changes: 2 additions & 3 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,8 @@ through `ICompiler`.
- Explicit arrays provide stable column/value order; RTTI property and
dictionary enumeration order should not be assumed.

[Examples](EXAMPLES.md) show usage. [Contributor notes](PORTING.md) retain
technical history and reference-test provenance; [validation](VALIDATION.md)
records what was compiled and executed.
[Examples](EXAMPLES.md) show usage. [Contributing](../CONTRIBUTING.md) explains
generated code and the SqlKata reference tests.

### Nullable object parameters

Expand Down
4 changes: 2 additions & 2 deletions docs/EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1359,8 +1359,8 @@ no live external adapter execution is claimed. The README quick starts
use the same query/execution operations; these examples are not a schema or
connection-management framework.

See [validation](VALIDATION.md) for actual run results, [API details](API.md) for
contracts, and [LICENSE](../LICENSE) for retained copyright and permission terms.
See [API details](API.md) for contracts, and [LICENSE](../LICENSE) for retained
copyright and permission terms.

## One nullable DTO for INSERT, SELECT and UPDATE

Expand Down
168 changes: 0 additions & 168 deletions docs/PORTING.md

This file was deleted.

Loading
Loading