feat(oracle): add experimental Oracle database support#4500
Open
mactav683 wants to merge 1 commit into
Open
Conversation
3df47a0 to
f4c531e
Compare
Add an experimental Oracle engine for the built-in Go code generator, mirroring the existing SQLite/MySQL engines. Enable with engine: "oracle". - parser: PL/SQL grammar (antlr/grammars-v4) generated with ANTLR 4.13.1 - convert: ANTLR parse tree to sqlc shared AST (DDL/DML, :1 and :name binds) - catalog + stdlib: schema resolution and built-in Oracle functions/types - reserved: Oracle reserved keywords for IsReservedKeyword - codegen: Oracle to Go type mapping targeting github.com/sijms/go-ora/v2 - wiring: config.EngineOracle, NewCompiler case, JSON schema enum, --dialect - docs: language-support, config, datatypes, changelog Covered by converter/catalog/type-mapping unit tests and an end-to-end golden-file fixture (testdata/oracle_authors/oracle).
f4c531e to
5eff438
Compare
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
Adds experimental Oracle database support to the built-in Go code generator, following the same architecture as the existing SQLite/MySQL engines.
Enable with
engine: "oracle".What's included
internal/engine/oracle/parser/): PL/SQL grammar from antlr/grammars-v4, generated with ANTLR 4.13.1 for the Go target.parse.go,convert.go): converts the ANTLR parse tree into sqlc's shared AST (CREATE TABLE, SELECT, INSERT, UPDATE, DELETE; positional:1and named:namebind variables).catalog.go,stdlib.go): schema resolution and ~45 built-in Oracle functions/types.reserved.go): ~115 Oracle reserved words forIsReservedKeyword.internal/codegen/golang/oracle_type.go): Oracle types to Go types targetinggithub.com/sijms/go-ora/v2(adatabase/sqldriver), using standardsql.Null*wrappers and honoringemit_pointers_for_null_types.config.EngineOracle,NewCompilerswitch case, JSON-schema enum entries, andsqlc parse --dialect oracle.language-support.rst,config.md,datatypes.md, and changelog updated.Tests
internal/endtoend/testdata/oracle_authors/oracle/;TestReplay/base/oracle_authors/oracleandTestFormatpass.go build ./...clean.Notes / follow-ups
NUMBERmaps tofloat64(the built-in analyzer does not track precision/scale); useINTEGER/INTor an override for integer columns.format.Dialectimplementation (format.go) to unlock theTestFormatround-trip, and a live-DB analyzer. A real database is not required for generator correctness.Closes #3881