query.back() = ')';
+ _D("%s", query.c_str());
+
int error = sqlite3_prepare_v2(__dbHandle, query.c_str(), -1, &__stmt, NULL);
IF_FAIL_VOID_TAG(error == SQLITE_OK, _E, "Preparation failed");
}
bool Database::Insertions::add(Tuple* tuple, Tuple* tupleExt)
{
IF_FAIL_RETURN(tuple, false);
+
__values.push_back(std::make_pair(tuple, tupleExt));
return true;
}
double dbl = 0;
for (unsigned int i = 0; i < tuple->size(); ++i) {
+ ++idx;
if (tuple->getAt(i, &str)) {
if (sqlite3_bind_text(__stmt, idx, str, -1, SQLITE_STATIC) != SQLITE_OK)
return E_FAILED;
_W("Unknown attribute type");
return E_FAILED;
}
- ++idx;
}
return idx;
if (__bind(tupleExt, __bind(tuple, 0)) != __dimension) {
_E("Binding failed");
- sqlite3_reset(__stmt);
return false;
}
_E("Execution failed");
return false;
}
+
+ sqlite3_reset(__stmt);
}
return true;
IF_FAIL_RETURN_TAG(__parse(), false, _E, "Parsing failed");
IF_FAIL_RETURN_TAG(idx < __numElements, false, _W, "Index out of range");
- if (!g_variant_is_of_type(__elements[idx], type)) {
- _W("Type mismatched");
+ if (!g_variant_is_of_type(__elements[idx], type))
return false;
- }
return true;
}
tuples.push_back(tuple);
} else {
_E("Memory allocation failed");
+ g_variant_unref(gVar);
}
} else if (g_variant_is_of_type(gVar, G_VARIANT_TYPE_ARRAY)) {
GVariantIter iter;
while ((child = g_variant_iter_next_value(&iter))) {
if (!g_variant_is_of_type(child, G_VARIANT_TYPE_TUPLE)) {
_E("Invalid data");
+ g_variant_unref(gVar);
continue;
}
tuple = new(std::nothrow) Tuple(child);
g_variant_unref(child);
}
}
+ g_variant_unref(gVar);
} else {
_E("Invalid data");
+ g_variant_unref(gVar);
}
- g_variant_unref(gVar);
return tuples;
}