Skip to content

Extract DeclaredType parsing from LibsqlResultSetMetaData #204

Closed

Description

@magnusp

Goal

Collapse the declared-type parsing in LibsqlResultSetMetaData into one value object. Three regexes and four matcher blocks currently encode the same "declared type or cast fallback" idea, and each getter repeats the null and empty handling.

Depends on

#203. Same file.

Pin

LibsqlResultSetMetaDataTest covers lower-case cast only, whitespace preservation in type names, malformed precision throwing NumberFormatException, and precision and scale from a parenthesized type.

Scope

  • Create DeclaredType with of(Col), typeName(), precision(), scale(), and isDeclared() from LibsqlResultSetMetaData 22 to 25, 160 to 184, 290 to 300, and 342 to 358.
  • getPrecision, getScale, getColumnTypeName, and isSigned delegate.

Preserve

  • getColumnTypeName preserves internal whitespace and upper-cases with Locale.ENGLISH.
  • getPrecision parses with Integer.parseInt and throws NumberFormatException unchecked.
  • getScale returns 0 unless there are exactly two comma-separated parts.
  • The cast fallback matches lowercase cast only and uses the original column name.

Acceptance

  • DeclaredType.java exists and holds the moved logic unchanged.
  • LibsqlResultSetMetaData.java is under 430 lines.
  • ./mvnw -pl libsql-jdbc -am test green with no assertion edited.
  • ./mvnw spotless:check green.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority: edge case, feature gap, or test/process improvement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions