- memset(szQuery, '\0', 1001);
- strncpy(szQuery, query, 1000);
-
- rv = sqlite3_prepare_v2(handle, szQuery, strlen(szQuery), &stmt, NULL);
- if (rv != SQLITE_OK) {
- err("fail to connect to table (%d)", rv);
- return FALSE;
- }
-
- if (in_param) {
- g_hash_table_iter_init(&iter, in_param);
- while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
- dbg("key(%s), value(%s)", (const char *)key, (const char *)value);
-
- if (!value || g_strcmp0((const char *)value, "") == 0) {
- dbg("bind null");
- rv = sqlite3_bind_null(stmt, atoi((const char *)key));
- } else {
- dbg("bind value");
- rv = sqlite3_bind_text(stmt, atoi((const char *)key), (const char *)value, strlen((const char *)value),
- SQLITE_STATIC);
- }
-
- if (rv != SQLITE_OK) {
- dbg("fail to bind data (%d)", rv);
- break;
- }
- }
- }
-
- if (rv != SQLITE_OK) {
- sqlite3_finalize(stmt);
- return FALSE;
- }