Files
five/_FiveSql2/Makefile
CharlesKWON e368402682 chore: audit cleanup — remove orphan parser + dead TSqlIndex methods
Opus 4.7 audit of the codebase surfaced several items that Opus 4.6
sessions left behind. This pass removes what's definitively dead and
fixes one trivial defensive bug; the real logic bugs (transaction
ordering, missing RunUpdate/RunDelete validation) come in a separate
commit.

Deletions:

- `_FiveSql2/src/TSqlParser_orig.prg` (1173 lines) — superseded by
  `TSqlParser2.prg` (Pratt). Production never instantiates the old
  parser; the only callers were the comparison/benchmark test files
  also being removed.
- `_FiveSql2/test/test_parser_cmp.prg` — compared orig vs Pratt AST,
  useless now that orig is gone.
- `_FiveSql2/test/bench_parser.prg` — benched both, same reason.
- `_FiveSql2/Makefile` `test_cmp:` and `bench:` targets referenced
  the removed files.
- `TSqlIndex.prg` methods `ApplyScope`, `ClearScope`, `ApplySeek`,
  `IndexInfo`, `CreateTempIndex`, `DropTempIndex` — each declared in
  the class header and implemented (~165 lines total) but zero
  callers anywhere in `_FiveSql2/` or `hbrtl/`. Class declarations
  removed alongside the bodies.

Small fixes:

- `TSqlDDL.prg:179-180` stale comment claiming Five doesn't support
  `@byref` — false since commit e95afad (2026-04-13) wired @byref
  via RefCell. The same method uses @nPos correctly elsewhere.
- `hbrt/class.go:tryBinaryOp` defensive nil-check on AsArray().
  IsObject() checks the type tag; a corrupted Value with tag=Object
  but ptr=nil would crash on `.Class`. Correct construction paths
  never hit this, but the guard is cheap.

Compat tests: FiveSql2 43/43, Harbour compat 56/56, Go test ALL PASS.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 22:46:17 +09:00

112 lines
3.7 KiB
Makefile

# ============================================================================
# FiveSql2 Makefile — SQL Engine with Pratt Parser (TSqlParser2)
#
# Usage:
# make Build all tests
# make test Run all tests
# make bench Run parser benchmark
# make clean Remove built files
#
# Requirements:
# - Harbour compiler (hbmk2) in PATH
# - Set HB_INSTALL_PREFIX to harbour-core root
#
# Example:
# export PATH="/path/to/harbour-core/bin/linux/gcc:$PATH"
# export HB_INSTALL_PREFIX="/path/to/harbour-core"
# make test
# ============================================================================
SRCDIR = src
TESTDIR = test
OUTDIR = bin
HB = hbmk2
HBFLAGS = -n -gtcgi -rebuild -I$(SRCDIR)
# Source files (order matters for Harbour compilation)
SOURCES = \
$(SRCDIR)/TSqlAlias.prg \
$(SRCDIR)/TSqlParser2.prg \
$(SRCDIR)/TFiveSQL.prg \
$(SRCDIR)/TSqlLexer.prg \
$(SRCDIR)/TSqlExpr.prg \
$(SRCDIR)/TSqlFunc.prg \
$(SRCDIR)/TSqlExecutor.prg \
$(SRCDIR)/TSqlIndex.prg \
$(SRCDIR)/TSqlAgg.prg \
$(SRCDIR)/TSqlSort.prg \
$(SRCDIR)/TSqlDDL.prg \
$(SRCDIR)/TSqlTxn.prg \
$(SRCDIR)/FiveSqlCls.prg \
$(SRCDIR)/FiveSqlDef.ch
# ============================================================================
# Build targets
# ============================================================================
all: $(OUTDIR) test_basic test_1999 test_hard test_standards test_challenge test_extreme
$(OUTDIR):
mkdir -p $(OUTDIR)
test_basic: $(OUTDIR)
$(HB) $(TESTDIR)/test_parser2.prg $(SOURCES) -o$(OUTDIR)/test_basic $(HBFLAGS)
test_1999: $(OUTDIR)
$(HB) $(TESTDIR)/test_sql1999.prg $(SOURCES) -o$(OUTDIR)/test_1999 $(HBFLAGS)
test_hard: $(OUTDIR)
$(HB) $(TESTDIR)/test_sql1999_hard.prg $(SOURCES) -o$(OUTDIR)/test_hard $(HBFLAGS)
test_standards: $(OUTDIR)
$(HB) $(TESTDIR)/test_sql_standards.prg $(SRCDIR)/TSqlParser2.prg $(SRCDIR)/TSqlLexer.prg $(SRCDIR)/TSqlExpr.prg $(SRCDIR)/TSqlFunc.prg $(SRCDIR)/FiveSqlDef.ch -o$(OUTDIR)/test_standards $(HBFLAGS)
test_challenge: $(OUTDIR)
$(HB) $(TESTDIR)/test_sql_challenge.prg $(SOURCES) -o$(OUTDIR)/test_challenge $(HBFLAGS)
test_extreme: $(OUTDIR)
$(HB) $(TESTDIR)/test_sql_extreme.prg $(SOURCES) -o$(OUTDIR)/test_extreme $(HBFLAGS)
# ============================================================================
# Run tests
# ============================================================================
test: all
@echo ""
@echo "================================================================"
@echo " FiveSql2 — Full Test Suite"
@echo "================================================================"
@echo ""
@echo "--- Basic (10 tests) ---"
@$(OUTDIR)/test_basic < /dev/null 2>&1 | tail -2
@echo ""
@echo "--- SQL:1999 (43 tests) ---"
@$(OUTDIR)/test_1999 < /dev/null 2>&1 | strings | grep "Rate"
@echo ""
@echo "--- Complex (10 tests) ---"
@$(OUTDIR)/test_hard < /dev/null 2>&1 | strings | grep "Rate"
@echo ""
@echo "--- Standards SQL:2003-2023 (64 tests) ---"
@$(OUTDIR)/test_standards < /dev/null 2>&1 | strings | grep "Rate"
@echo ""
@echo "--- Challenge (15 tests) ---"
@$(OUTDIR)/test_challenge < /dev/null 2>&1 | strings | grep "Rate"
@echo ""
@echo "--- Extreme (15 tests) ---"
@$(OUTDIR)/test_extreme < /dev/null 2>&1 | strings | grep "Rate"
@echo ""
@echo "================================================================"
@echo " All test suites completed."
@echo "================================================================"
# ============================================================================
# Clean
# ============================================================================
clean:
rm -rf $(OUTDIR)
rm -f *.dbf *.ntx *.cdx __cte_*.dbf
.PHONY: all test bench clean