I am trying to retrieve all nullable collumns from an SQLite Database in java.
I don't know why JDBC is returning that only the Primary Key is Not NULL when there are two columns with not nullproperty.
CREATE TABLE `univDB` (
`x` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`FirstColumn` TEXT NOT NULL,
`SecondColumn` TEXT
);
and when I run the following code:
ResultSet rs = stmt.executeQuery("SELECT * FROM "+table);
for (int i=1; i<= rs.getMetaData().getColumnCount(); i++) {
System.out.println("NULLABLE column "+i+" "+rs.getMetaData().isNullable(i));
if (ResultSetMetaData.columnNoNulls == rs.getMetaData().isNullable(i)) {
System.out.println("Column Not Null "+rs.getMetaData().getColumnName(i));
}
}
I get that x is the only non-nullable column of the DB but there should be FirstColumn too.
Aucun commentaire:
Enregistrer un commentaire