Add SQLite compiletime natives#1203
Draft
Donach wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add SQLite-backed compiletime natives to the interpreter:
The API uses integer handles at the Wurst boundary while keeping JDBC resources encapsulated in
CompiletimeNatives. Bind indexes follow JDBC's 1-based convention; result column indexes are 0-based for Wurst array-style access.Motivation
Wurst projects with larger structured content catalogs currently have to generate or parse intermediate text before compilation. Compiletime SQLite access lets them query a reviewed SQLite catalog directly while object generation and compiletime registration run.
The compiler already ships
sqlite-jdbc; this change exposes that existing capability to compiletime Wurst code without adding a dependency.Resource and error handling
Tests
The interpreter-level test exercises an in-memory database end to end, including:
Validation run against upstream
50080cdb9f4e8dda9361feb40a42f7bdfb8f6f21:./gradlew test --tests tests.wurstscript.tests.CompiletimeTests.testCompiletimeSQLite./gradlew test --tests tests.wurstscript.tests.CompiletimeTests --tests tests.wurstscript.tests.CompiletimeNativesTest./gradlew shadowJar --no-daemon./gradlew test --no-daemon— full suite passed