Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add facility to handle non null column type #359

Merged
merged 4 commits into from Mar 21, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -19,6 +19,7 @@
*/
package herddb.core.system;

import java.sql.DatabaseMetaData;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -61,14 +62,15 @@ protected Iterable<Record> buildVirtualRecordList() {
int pos = 1;
for (Column c : t.columns) {
boolean pk = t.isPrimaryKeyColumn(c.name);
boolean nonNullCType = pk ? true : ColumnTypes.isNotNullDataType(c.type);
String data_type = ColumnTypes.typeToString(c.type);

result.add(RecordSerializer.makeRecord(
table,
"table_name", t.name,
"column_name", c.name,
"ordinal_position", pos++,
"is_nullable", pk ? 0 : 1,
"is_nullable", (pk || nonNullCType) ? DatabaseMetaData.columnNoNulls : DatabaseMetaData.columnNullable,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't "pl" reduntant here ?
if ("pk") nonNullCType is already true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct. I removed it.

"data_type", data_type,
"auto_increment", (pk && t.auto_increment)?1:0
));
Expand Down