Skip to content

JDBC driver impl of DatabaseMetadata#getTypeInfo() is rather incomplete #937

Open
@rsmckinney

Description

@rsmckinney

The result returned from DatabaseMetadata#getTypeInfo() is a very small (useless) subset of the SQL types sqlite provides.

  1. Run the following on any database:
ResultSet rs = dbMetaData.getTypeInfo();
while (rs.next())
  out.println(rs.getString("TYPE_NAME") + "\t" + JDBCType.valueOf(rs.getInt("DATA_TYPE")).getName());
  1. Result:
BLOB	BLOB
INTEGER	INTEGER
NULL	NULL
REAL	REAL
TEXT	VARCHAR
  1. As you can see, these mappings only cover a small fraction of the available sqlite SQL types. I was hoping to use this to overcome DatabaseMetaData#getColumns() returns conflicting results for ResultSet#getInt("DATA_TYPE") and ResultSet#getString("TYPE_NAME") #935.
  2. Given all the shortcuts taken in this driver wrt type-safety, one has to conclude the implementers don't consider type-safety a worthwhile aspect. If that is the case, please let me know so I can account for that in my project (and stop filing issues here). Thanks.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions