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>
46 lines
1.3 KiB
Plaintext
46 lines
1.3 KiB
Plaintext
#include "FiveSqlDef.ch"
|
|
|
|
FUNCTION Main()
|
|
LOCAL aResult, oErr
|
|
|
|
dbCreate("fp_test", { {"ID","N",4,0}, {"NAME","C",20,0} })
|
|
USE "fp_test" NEW EXCLUSIVE
|
|
APPEND BLANK
|
|
REPLACE ID WITH 1, NAME WITH "Alice"
|
|
APPEND BLANK
|
|
REPLACE ID WITH 2, NAME WITH "Bob"
|
|
CLOSE ALL
|
|
|
|
? "=== full path test ==="
|
|
BEGIN SEQUENCE
|
|
aResult := five_SQL("SELECT id, name FROM fp_test")
|
|
IF ValType(aResult) == "A" .AND. Len(aResult) >= 2
|
|
IF ValType(aResult[1]) == "A" .AND. Len(aResult[1]) > 0
|
|
IF aResult[1][1] == "__error__"
|
|
? "SQL Error:", aResult[2][1][2]
|
|
ELSE
|
|
? "Fields:", Len(aResult[1]), "Rows:", Len(aResult[2])
|
|
LOCAL i
|
|
FOR i := 1 TO Len(aResult[1])
|
|
?? aResult[1][i] + " "
|
|
NEXT
|
|
?
|
|
LOCAL j
|
|
FOR j := 1 TO Len(aResult[2])
|
|
? " Row", j, ":"
|
|
LOCAL k
|
|
FOR k := 1 TO Len(aResult[2][j])
|
|
?? " " + hb_ntos(aResult[2][j][k])
|
|
NEXT
|
|
NEXT
|
|
ENDIF
|
|
ENDIF
|
|
ENDIF
|
|
RECOVER USING oErr
|
|
? "Exception:", oErr
|
|
END SEQUENCE
|
|
|
|
FErase("fp_test.dbf")
|
|
? "=== DONE ==="
|
|
RETURN NIL
|