[Bug/Feature] Arrays were not correctly handled.
[Cause] N/A
[Solution] N/A
[Verification] Build, run tests
Change-Id: Idd5c2c35baf602e09961ee8af80857dda313a5da
int getArraySize(std::string& name, json_object* object)
{
- int length = -1, jlength = json_object_array_length(object);
if (mStorePtr->exists(name)) {
- length = mStorePtr->get<int>(name);
+ return mStorePtr->get<int>(name);
}
- return length != jlength ? jlength : length;
+ return json_object_array_length(object);
}
template<typename T>
Connection::Connection(const std::string& path)
{
+ if (path.empty()) {
+ // Sqlite creates temporary database in case of empty path
+ // but we want to forbid this.
+ throw ConfigException("Error opening the database: empty path");
+ }
if (::sqlite3_open_v2(path.c_str(),
&mDbPtr,
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,