-API int set_number_pref_to_condition(ADVANCED_HANDLE handle)
-{
- ADVANCED_RETURN_VAL((handle != NULL), {}, QUERY_HANDLE_NONE, ("HANDLE IS NULL"));
- advanced_handle_t* q_handle = (advanced_handle_t*)handle;
-
- q_handle->set_number_pref = 1;
-
- return QUERY_SUCCESS;
-}
-
-API int set_email_pref_to_condition(ADVANCED_HANDLE handle)
-{
- ADVANCED_RETURN_VAL((handle != NULL), {}, QUERY_HANDLE_NONE, ("HANDLE IS NULL"));
- advanced_handle_t* q_handle = (advanced_handle_t*)handle;
-
- q_handle->set_email_pref = 1;
-
- return QUERY_SUCCESS;
-}
-
-API int check_pref_number(int contact_id, char* number)
-{
- char query[256 + 1] = {0, };
- int rc = -1;
- stmt pStmt = NULL;
- int pref = 0;
- query_error error_code = QUERY_SUCCESS;
-
- error_code = _contact_db_init();
- ADVANCED_CATCH_SET_ERROR((error_code == QUERY_SUCCESS), {}, QUERY_STATEMENT_FAIL, ("DATABASE INIT FAIL"));
-
- snprintf(query, 256, "%s", "select is_default from data where contact_id = ? and data3 = ? and datatype = 8");
-
- pStmt = _contact_query_prepare(query);
- ADVANCED_CATCH_SET_ERROR((pStmt != NULL), {}, QUERY_STATEMENT_FAIL, ("database prepare fail"));
-
- _contact_query_bind_int(pStmt, 1, contact_id);
- _contact_query_bind_text(pStmt, 2, number);
-
- rc = _contact_query_step(pStmt);
- ADVANCED_CATCH_SET_ERROR((rc == SQLITE_ROW), {}, QUERY_NO_RECORD, ("No record in database"));
-
- pref = _ct_query_column_int(pStmt, 0);
- ADVANCED_SVC_TRACE("pref: %d ", pref);
-
-CATCH:
- _ct_query_finalize(pStmt);
- _contact_db_finish();
-
- return pref;
-}
-
-API int check_pref_email(int contact_id, char* email)
-{
- char query[256 + 1] = {0, };
- int rc = -1;
- stmt pStmt = NULL;
- int pref = 0;
- query_error error_code = QUERY_SUCCESS;
-
- error_code = _contact_db_init();
- ADVANCED_CATCH_SET_ERROR((error_code == QUERY_SUCCESS), {}, QUERY_STATEMENT_FAIL, ("DATABASE INIT FAIL"));
-
- snprintf(query, 256, "%s", "select is_default from data where contact_id = ? and data3 = ? and datatype = 9");
-
- pStmt = _contact_query_prepare(query);
- ADVANCED_CATCH_SET_ERROR((pStmt != NULL), {}, QUERY_STATEMENT_FAIL, ("database prepare fail"));
-
- _contact_query_bind_int(pStmt, 1, contact_id);
- _contact_query_bind_text(pStmt, 2, email);
-
- rc = _contact_query_step(pStmt);
- ADVANCED_CATCH_SET_ERROR((rc == SQLITE_ROW), {}, QUERY_NO_RECORD, ("No record in database"));
-
- pref = _ct_query_column_int(pStmt, 0);
- ADVANCED_SVC_TRACE("pref: %d ", pref);
-
-CATCH:
- _ct_query_finalize(pStmt);
- _contact_db_finish();
-
- return pref;
-}
-