Skip to content

Commit

Permalink
Fix bug where ACS wasn't being stored properly
Browse files Browse the repository at this point in the history
  • Loading branch information
paladine committed Sep 30, 2024
1 parent da3e006 commit 3fa0f54
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
11 changes: 0 additions & 11 deletions btrieve/BindableValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ class BindableValue {
}
}

BindableValue(const char *str, size_t nChars) {
if (str == nullptr || !*str) {
type = Type::Null;
} else {
type = Type::Text;
text_value = new std::string();
text_value->resize(nChars);
memcpy(text_value->data(), str, nChars);
}
}

BindableValue(const std::string_view data)
: type(Type::Text), text_value(new std::string(data)) {}

Expand Down
11 changes: 9 additions & 2 deletions btrieve/SqliteDatabase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,15 @@ void SqliteDatabase::createSqliteMetadataTable(
command.bindParameter(5, BindableValue(CURRENT_VERSION));
if (!database.getKeys().empty()) {
command.bindParameter(6, BindableValue(database.getKeys()[0].getACSName()));
command.bindParameter(
7, BindableValue(database.getKeys()[0].getACS(), ACS_LENGTH));
if (database.getKeys()[0].getACS() == nullptr) {
command.bindParameter(7, BindableValue()); // bind null
} else {
command.bindParameter(
7,
BindableValue(std::basic_string<uint8_t>(
reinterpret_cast<const uint8_t *>(database.getKeys()[0].getACS()),
ACS_LENGTH)));
}
} else {
command.bindParameter(6, BindableValue());
command.bindParameter(7, BindableValue());
Expand Down
2 changes: 0 additions & 2 deletions vstudio/wbtrv32/wbtrv32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,15 +590,13 @@ static BtrieveError handle(BtrieveCommand &command) {
error = ::GetDirectRecord(command);
break;
case OperationCode::Update:
// TODO update logical currency
error = ::Upsert(command, [](BtrieveDriver *driver,
std::basic_string_view<uint8_t> record) {
auto position = driver->getPosition();
return std::make_pair(driver->updateRecord(position, record), position);
});
break;
case OperationCode::Insert:
// TODO update logical currency
error = ::Upsert(command, [](BtrieveDriver *driver,
std::basic_string_view<uint8_t> record) {
return driver->insertRecord(record);
Expand Down

0 comments on commit 3fa0f54

Please sign in to comment.