args valueType range 判断

Signed-off-by: zhangdi <zhangdi126@huawei.com>
This commit is contained in:
zhangdi 2024-11-13 15:58:37 +08:00
parent 3c0bf2dd99
commit 5a70c4cdc9
2 changed files with 8 additions and 3 deletions

View File

@ -1002,7 +1002,7 @@ int SqliteConnection::TryCheckPoint(bool timeout)
int SqliteConnection::LimitWalSize()
{
if (!isConfigured_ || !isWriter_ || config_.IsMemoryRdb()) {
if (!isConfigured_ || !isWriter_) {
return E_OK;
}

View File

@ -160,9 +160,14 @@ int SqliteStatement::BindArgs(const std::vector<std::reference_wrapper<ValueObje
bound_ = true;
int index = 1;
for (auto &arg : bindArgs) {
auto action = ACTIONS[arg.get().value.index()];
auto valueType = arg.get().value.index();
if (valueType < ValueObject::TYPE_NULL || valueType >= ValueObject::TYPE_BUTT) {
LOG_ERROR("index is out of range, index is %{public}zu", valueType);
return E_INVALID_ARGS;
}
auto action = ACTIONS[valueType];
if (action == nullptr) {
LOG_ERROR("not support the type %{public}zu", arg.get().value.index());
LOG_ERROR("not support the type %{public}zu", valueType);
return E_INVALID_ARGS;
}
auto errCode = action(stmt_, index, arg.get().value);