DX improvements: RowCodec.of(), insertIntoGeneratedKeys, cross-DB RoutineAnalyzer, Oracle fixes#32
Open
oyvindberg wants to merge 9 commits intomainfrom
Open
DX improvements: RowCodec.of(), insertIntoGeneratedKeys, cross-DB RoutineAnalyzer, Oracle fixes#32oyvindberg wants to merge 9 commits intomainfrom
oyvindberg wants to merge 9 commits intomainfrom
Conversation
…apper bugs, support Scala types in scanner - Fix Mapped.opt() in all 5 DbRead implementations (DuckDb, Pg, Maria, SqlServer, Db2) to delegate null detection to the underlying reader instead of wrapping the already-mapped value with Optional.ofNullable(). This fixes LEFT/FULL JOIN codecs that use transformed types (e.g. Scala Option, Kotlin nullable). - Add RowCodecNamed.columnList(String alias) in Java, Kotlin, and Scala for generating alias-prefixed column lists in JOIN queries (e.g. "v.id, v.name"). - Fix Kotlin Transactor.execute() to run operations through Kotlin-side wrappers (Combine→Pair, IfEmpty→nullable) instead of bypassing them via Java underlying. - Fix Kotlin Operation.Configured.run() to delegate to Kotlin inner operation instead of casting Java underlying result. - Add Scala type support (Option, List, Seq, Map) to AnalyzableScanner.constructDummy() using class name matching to avoid hard dependency on Scala runtime. - Change Scala DuckDbType.mapTo() to return scala.collection.immutable.Map instead of java.util.Map, consistent with how list already returns scala List. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ated code - Redesign ProcedureOp to use typed closures (direct/mapped factory methods) instead of Operation<Any?> + (Any?) -> Out, eliminating all casts in Procedure.call(), fromVoid(), and fromJava(). - Update DbProcedure/DbFunction sourcegen to use ProcedureOp.direct() and ProcedureOp.mapped() instead of casting to Operation<Any?>, removing all @Suppress("UNCHECKED_CAST") from generated procedure/function builders. - Delete Bijection.optionalToNullableUnchecked() and unused nullableToOptional(). Remove : Any bound from optionalToNullable() so all DbType.opt() callers use it directly. One narrow cast remains (Optional<T & Any> -> Optional<T>) which is a known Kotlin type system limitation with no stdlib workaround. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document the exact JDBC metadata behavior for all six supported databases based on empirical testing. Covers column types, column nullability, outer join nullability, parameter types, expressions, aggregates, CTEs, and UNIONs. Links from the main query analysis page, reference page, and landing page. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… RoutineDef, PG procedure CALL
- Fix query analyzer serial/bigserial/smallserial aliases and schema-qualified enum quoting
- Add Operation.Execute using stmt.execute() for Fragment.execute() (works with any SQL)
- PostgreSQL procedures use CALL with PreparedStatement instead of {call} with CallableStatement
- Rename streamingInsert → StreamingInsert, thenIgnore → productL
- Kotlin/Scala transform() accepts native language functions instead of SqlFunction
- Move transactor() from DatabaseConfig/Builders to Transactor.create(config) static factories
- Add RoutineDef interface with procedure(), checkRoutine(RoutineDef) on QueryChecker
- Sourcegen: Def interfaces extend RoutineDef, build() returns implementations with procedure()
- Update all docs, examples, and regenerate snippets.json
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
767d524 to
2561bf3
Compare
…ineAnalyzer, Oracle fixes - Codegen RowCodec.of(t0, t1, ...) for arities 2-22 returning Tuple types (Java, Kotlin, Scala) - Add Fragment.insertIntoGeneratedKeys() for Oracle/SQL Server/MariaDB/DB2 INSERT + generated keys - Fix RoutineAnalyzer.analyzeFunction() to use CAST(NULL AS type) on non-PG/DuckDB databases - Fix RoutineAnalyzer.analyzeProcedure() to retry with uppercase name for Oracle - Add FROM DUAL suffix for Oracle/DB2 function analysis - Add CHAR→VARCHAR2 vendor alias in OracleTypes for query analysis - Document Oracle nullability behavior (empty string = NULL) - Add compile-checked OBJECT/VARRAY/NESTED TABLE doc snippets in Java/Kotlin/Scala Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nsertIntoGeneratedKeys - Fix DB2 query analyzer false positives: add withVendorTypeNames() to int_, numeric, dec, float_, character, and numeric(p,s) aliases so they match canonical JDBC metadata names - Document executeVoid() in operations.md with compile-checked snippets (Java/Kotlin/Scala) - Expand Tuple documentation in row-codecs.md: clarify _1()/_2()/_3() accessors apply to RowCodec.of(), combine(), and joined() — not just joins - Add "Generated Keys Inserts" section to row-codecs.md documenting Fragment.insertIntoGeneratedKeys() for databases without RETURNING (DB2, Oracle, SQL Server, MariaDB) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New foundations-jdbc-otel module with OpenTelemetry instrumentation: - DatabaseSystem enum mapping DatabaseKind to OTel db.system.name - TelemetryConfig with builder and JDBC URL auto-parsing - OtelQueryListener using backdated spans (no ThreadLocal, virtual-thread safe) - PoolMetrics for HikariCP connection pool gauges - Pre-built Grafana dashboard (latency, errors, throughput, pool metrics) MariaDB VECTOR type for 11.7+ (MariaTypes.vector(dimension)): - MariaRead/Write/Json/OutParam support via connector FloatArrayCodec Documentation: OTel setup guide with compile-checked snippets (Java/Kotlin/Scala), updated observability page, sidebar entry. Fix Scala doc examples: scala.Map vs java.util.Map mismatch in MapTypes/TypeSafeDbTypes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- UUID type (MariaDB 10.7+): maps to java.util.UUID via string read/write - VECTOR type wrappers added to Kotlin/Scala (Java was in prior commit) - Test cases for UUID (standard, nil, max) and VECTOR (1/3/5 dimensions) - Bump test container from MariaDB 11.4 to 11.7 for VECTOR support - Fix test project to discover Java tests (sources, testFrameworks config) - Documentation snippets for UUID and VECTOR across Java/Kotlin/Scala Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
RowCodec.of(t0, t1, ...)for arities 2-22 returning Tuple types (Java, Kotlin with native tuples, Scala with native tuples)getGeneratedKeys()analyzeFunction()now usesCAST(NULL AS type)on non-PG/DuckDB databases instead of PG-onlynull::type; addsFROM DUALfor Oracle/DB2; retries uppercase procedure name lookup for Oraclechar_now includesvarchar2as vendor alias for query analysis matchingint_,numeric,dec,float_,characterby addingwithVendorTypeNames()to match canonical JDBC metadata namesexecuteVoid(): Add compile-checked snippets (Java/Kotlin/Scala) to operations.md for void operations (DDL, schema setup)._1(),._2(),._3()pattern applies toRowCodec.of(),.combine(), and.joined()— not just joinsinsertIntoGeneratedKeys: New "Generated Keys Inserts" section in row-codecs.md with compile-checked snippets for DB2/Oracle/SQL Server/MariaDBCommits
Test plan
foundations-jdbc,hikari,spring,kotlin,scala)🤖 Generated with Claude Code