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

Unknown computed column type #5377

Merged
merged 4 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
16 changes: 13 additions & 3 deletions CommonData/column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,22 @@ void Column::loadComputedColumnJsonBackwardsCompatibly(const Json::Value & json)
//Columnname is used to find this:
//_column = DataSetPackage::pkg()->dataSet()->column(json["name"].asString());

const std::string & rCode = json["rCode"].asString();

const std::string & rCode = json["rCode"].asString(),
& codeTypeStr = json["codeType"].asString();

computedColumnType codeType = computedColumnType::notComputed;
if (!codeTypeStr.empty())
{
try { codeType = computedColumnTypeFromString(codeTypeStr); }
catch(...) {}
}

try { codeType = computedColumnTypeFromString(codeTypeStr); } catch(...) {}

setCompColStuff
(
json["invalidated"].asBool(),
computedColumnTypeFromString(json["codeType"].asString()),
codeType,
rCode,
Copy link
Contributor

Choose a reason for hiding this comment

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

You dont need to make changes to column.cpp I think?

Just the change to DatabaseInterface::columnGetComputedInfo should be enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was not quite completely sure that this error could not arise here. For the case, it does not hurt I fimd.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah but if the changes are not necessary at all why make them?

json["error"].asString(),
json["constructorCode"]
Expand Down
7 changes: 6 additions & 1 deletion CommonData/databaseinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,12 @@ bool DatabaseInterface::columnGetComputedInfo(int columnId, int &analysisId, boo
std::string constructorJsonStr = _wrap_sqlite3_column_text(stmt, 5);
analysisId = sqlite3_column_int( stmt, 6);

codeType = codeTypeStr.empty() ? computedColumnType::notComputed : computedColumnTypeFromString(codeTypeStr);
codeType = computedColumnType::notComputed;
if (!codeTypeStr.empty())
{
try { codeType = computedColumnTypeFromString(codeTypeStr); }
catch(...) {}
}
JorisGoosen marked this conversation as resolved.
Show resolved Hide resolved

constructorJson = Json::objectValue;
Json::Reader().parse(constructorJsonStr, constructorJson);
Expand Down
Loading