Skip to content

Extract the AUTOINCREMENT grammar from LibsqlResultSetMetaData #202

Closed

Description

@magnusp

Goal

Move the AUTOINCREMENT grammar out of LibsqlResultSetMetaData. About 120 lines of token-level SQL parsing currently sit between JDBC metadata getters, reachable through a package-private static seam from LibsqlDatabaseMetaData.

Depends on

None. First pass in the LibsqlResultSetMetaData chain.

Pin

LibsqlResultSetMetaDataTest covers comments, string literals, column names that look like the keyword, table-level constraints, quoted identifiers, and unsupported shapes. LibsqlDatabaseMetaDataTest.getColumnsReportsDeclaredTypesSizesNullabilityAndAutoIncrement covers the joined path.

Scope

  • Create SqlAutoIncrement with isAutoIncrementColumn(String createSql, String columnName) and the helpers from LibsqlResultSetMetaData 73 to 88 and 529 to 648.
  • Update the two call sites, LibsqlResultSetMetaData line 70 and LibsqlDatabaseMetaData line 551.

Preserve

  • Keyword sets, the constraint-name skip, and the depth constants.
  • Quoted identifiers and comments and literals are not keyword matches. Do not replace the parser with a substring search.
  • The caller still requires info.primaryKey(). AUTOINCREMENT alone is not enough.

Acceptance

  • SqlAutoIncrement.java exists and holds the moved code unchanged.
  • LibsqlResultSetMetaData.java is under 580 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