https://docs.tizen.org/application/native/api/mobile/5.5/group__CAPI__DATA__CONTROL__CONSUMER__MODULE.html#gaf8891d1ab8c938ada38f9668c2c9fa52
Вы можете увидеть ссылку на API
Он не взаимозаменяем с data_control_h
. См. Код ниже. Однако это не полный код. Поэтому вам нужно изменить пример кода
/* provider application */
void bulk_insert_request_cb(int request_id, data_control_h provider,
data_control_bulk_data_h bulk_data_h, void *user_data)
{
dlog_print(DLOG_INFO, LOG_TAG, "[bulk insert_request_cb] %d", request_id);
data_control_bulk_result_data_h result_data_h;
char* command = NULL;
int i, ret;
int count;
long long inserted_row_id;
bundle *data;
data_control_bulk_data_get_count(bulk_data_h, &count);
dlog_print(DLOG_INFO, LOG_TAG, "[bulk insert_request_cb] count %d", count);
data_control_bulk_result_data_create(&result_data_h);
for (i = 0; i < count; i++) {
data_control_bulk_data_get_data(bulk_data_h, i, &data);
command = data_control_provider_create_insert_statement(provider, data);
ret = sqlite3_exec(db, command, NULL, NULL, NULL);
free(command);
if (ret != SQLITE_OK) {
data_control_bulk_result_data_add(result_data_h, data, sqlite3_errcode(db));
continue;
}
dlog_print(DLOG_INFO, LOG_TAG, "insert success");
inserted_row_id = sqlite3_last_insert_rowid(db);
data_control_bulk_result_data_add(result_data_h, data, DATA_CONTROL_ERROR_NONE);
}
ret = data_control_provider_send_bulk_insert_result(request_id, result_data_h);
if (ret != DATA_CONTROL_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG,
"send_bulk_insert_result failed with error: %d",ret);
}
data_control_bulk_result_data_destroy(result_data_h);
}
void initialize_datacontrol_provider()
{
data_control_provider_sql_register_insert_bulk_data_request_cb(bulk_insert_request_cb, NULL);
if (result != DATA_CONTROL_ERROR_NONE)
dlog_print(DLOG_ERROR, LOG_TAG, "data_control_provider_sql_register_insert_bulk_data_request_cb failed with error: %d", result);
else
dlog_print(DLOG_INFO, LOG_TAG, "Provider SQL Bulk register success");
}
/* Consumer Application */
int insert_bulk_data()
{
data_control_bulk_data_h bulk_data_h;
bundle *b1;
bundle *b2;
int req_id;
int result;
int count;
result = data_control_sql_register_insert_bulk_data_response_cb(<your handle>, <your response cb>, NULL);
assert_eq_with_exit(result, DATA_CONTROL_ERROR_NONE);
b1 = bundle_create();
bundle_add_str(b1, "WORD", "'bulk test'");
bundle_add_str(b1, "WORD_DESC", "'bulk test description'");
b2 = bundle_create();
bundle_add_str(b2, "WORD", "'bulk test'");
bundle_add_str(b2, "WORD_DESC", "'bulk test description'");
data_control_bulk_data_create(&bulk_data_h);
data_control_bulk_data_add(bulk_data_h, b1);
data_control_bulk_data_add(bulk_data_h, b2);
data_control_bulk_data_get_count(bulk_data_h, &count);
dlog_print(DLOG_INFO, "NativeTCT", "bulk insert count %d", count);
__correct_row_cnt = count;
result = data_control_sql_insert_bulk_data(g_provider, bulk_data_h, &req_id);
assert_eq_with_exit(result, DATA_CONTROL_ERROR_NONE);
data_control_bulk_data_destroy(bulk_data_h);
bundle_free(b1);
bundle_free(b2);
}