Skip to content

Extract SqliteRealText from LibsqlResultSet #198

Closed

Description

@magnusp

Goal

Move the SQLite REAL text formatter out of LibsqlResultSet. It is a 258-line fixed-point port of SQLite's printf("%!.17g"), all private static, with two call sites and no cursor state.

Depends on

None. This is the first pass in the LibsqlResultSet chain. The later passes in the chain are blocked by it because they edit the same file.

Pin

LibsqlResultSetRealTextTest covers canonical form, scale, repeated reads, fixed-notation bounds, and bytes. LibsqlResultSetTest covers integral truncation and BLOB-as-text.

Scope

  • Create SqliteRealText with static String format(double), the four power tables, and the private fixed-point helpers moved verbatim (LibsqlResultSet 187 to 444).
  • Point getString (line 181) and getBytes (line 641) at it.

Preserve

  • The algorithm and tables byte for byte. Do not substitute BigDecimal.toPlainString, Double.toString, or String.format.
  • Negative zero renders 0.0. Exponents render signed and zero padded to two digits. NaN renders NaN.
  • Fixed notation applies when the decimal exponent is between -4 and 16.

Acceptance

  • SqliteRealText.java exists and holds the moved code unchanged.
  • LibsqlResultSet.java is under 1250 lines.
  • ./mvnw -pl libsql-jdbc -am test green with no assertion edited.
  • ./mvnw spotless:check green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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