fdb-record-layer icon indicating copy to clipboard operation
fdb-record-layer copied to clipboard

Adopt dataType for Literals and preparedValues

Open g31pranjal opened this issue 5 months ago • 0 comments

This PR moves away from using java.sql.Types in the internals of fdb-relational-core, while still maintaining JDBC-compliance for external getType()-like operations. It is replaced with DataType, which provides richer and more diverse type information available for downstream operations. Notably, we can now have types like Uuid, Enum, Version expressed natively. There are several consequences of this:

  • It eliminates SQLType <-> RecordType conversions and instead relies on DataType <-> RecordType conversions, which were already being used for DDL work. This is more consistent as it is used throughout the codebase.
  • StructMetadata and ArrayMetadata wrap DataType as the source of truth for their type info. However, they still map to sql.Types externally. Moreover, they now expose getRelationalDataType() that returns DataType to the external users for more transparency.
  • Aligning to the above changes, grpc protobufs now have a Type enum, moving away from sql.Types too. This was needed to support struct and array operations homogenously across embedded and JDBC drivers. It keeps the old types too for backward compatibility, which I think should be removed in future to simplify conversions.

g31pranjal avatar Jun 12 '25 17:06 g31pranjal