Files
five/_FiveSql2/test/test_mini.prg
Charles KWON OhJun 486e466592 feat: FiveSql2 43/43, @byref, mutable closure, RTL 479, DateTime fix
Major changes since last commit:
- FiveSql2 SQL:1999 engine (10,458 LOC) — 43/43 ALL PASS
- 21 compiler/runtime bugs fixed (short-circuit AND/OR, FOR LOOP, etc.)
- @byref pass-by-reference via RefCell pattern
- Mutable closure capture (EnsureLocalRef + RefCell sharing)
- RTL: 400 → 479 functions (+79: file, string, datetime, hash, UTF-8)
- DateTime/Timestamp fully working (hb_DateTime, hb_Hour/Min/Sec, display)
- Reserved word guard (39 keywords blocked from function calls)
- AEval arg order fix (element before index)
- Closure capture redecl fix (unique _cap_ names per block)
- Hash/string indexing in ArrayPush/ArrayPop
- Harbour compat test suite: 51/51
- 4 docs: Porting Report, Implementation Plan, Optimization Plan, Commercialization

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 11:35:37 +09:00

48 lines
1.2 KiB
Plaintext

// Minimal FiveSql2 test — just SELECT from a single table
#include "FiveSqlDef.ch"
FUNCTION Main()
LOCAL aResult, aFN, aRows
? "=== FiveSql2 Mini Test ==="
// Create test table
? "Creating table..."
dbCreate("mini_test", { {"ID","N",4,0}, {"NAME","C",20,0} })
USE mini_test NEW EXCLUSIVE
? "Table opened, adding records..."
APPEND BLANK
REPLACE ID WITH 1, NAME WITH "Alice"
APPEND BLANK
REPLACE ID WITH 2, NAME WITH "Bob"
APPEND BLANK
REPLACE ID WITH 3, NAME WITH "Charlie"
? "Records:", RecCount()
CLOSE ALL
// Run simple SQL
? "Running SQL..."
aResult := five_SQL("SELECT * FROM mini_test")
? "Result type:", ValType(aResult)
IF ValType(aResult) == "A" .AND. Len(aResult) >= 2
aFN := aResult[1]
aRows := aResult[2]
? "Fields:", Len(aFN), "Rows:", Len(aRows)
IF Len(aFN) > 0
? "Field names:", aFN[1], aFN[2]
ENDIF
IF Len(aRows) > 0
? "Row 1:", aRows[1][1], aRows[1][2]
? "Row 2:", aRows[2][1], aRows[2][2]
? "Row 3:", aRows[3][1], aRows[3][2]
ENDIF
ELSE
? "ERROR or unexpected result"
ENDIF
// Cleanup
FErase("mini_test.dbf")
? "=== DONE ==="
RETURN NIL