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

Treat unknown types as Strings in ODBCDriver2 format #276

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion driver/api/odbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1013,9 +1013,14 @@ SQLRETURN SQL_API EXPORTED_FUNCTION_MAYBE_W(SQLColumns)(

if (parser.parse(&ast)) {
tmp_column_info.assignTypeInfo(ast);

if (convertUnparametrizedTypeNameToTypeId(tmp_column_info.type_without_parameters) == DataSourceTypeId::Unknown) {
// Interpret all unknown types as String.
tmp_column_info.type_without_parameters = "String";
}
}
else {
// Interpret all unknown types as String.
// Interpret all unparsable types as String.
tmp_column_info.type_without_parameters = "String";
}

Expand Down
7 changes: 6 additions & 1 deletion driver/format/ODBCDriver2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ ODBCDriver2ResultSet::ODBCDriver2ResultSet(AmortizedIStreamReader & stream, std:

if (parser.parse(&ast)) {
columns_info[i].assignTypeInfo(ast);

if (convertUnparametrizedTypeNameToTypeId(columns_info[i].type_without_parameters) == DataSourceTypeId::Unknown) {
// Interpret all unknown types as String.
columns_info[i].type_without_parameters = "String";
}
}
else {
// Interpret all unknown types as String.
// Interpret all unparsable types as String.
columns_info[i].type_without_parameters = "String";
}

Expand Down
2 changes: 1 addition & 1 deletion driver/format/RowBinaryWithNamesAndTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RowBinaryWithNamesAndTypesResultSet::RowBinaryWithNamesAndTypesResultSet(Amortiz
columns_info[i].assignTypeInfo(ast);
}
else {
// Interpret all unknown types as String.
// Interpret all unparsable types as String.
columns_info[i].type_without_parameters = "String";
}

Expand Down
2 changes: 1 addition & 1 deletion driver/result_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void ColumnInfo::assignTypeInfo(const TypeAst & ast) {
assignTypeInfo(ast.elements.front());
}
else {
// Interpret all unsupported types as String.
// Interpret all types with unrecognized ASTs as String.
type_without_parameters = "String";
}
}
Expand Down