Update change log and spec for wrt-plugins-tizen_0.2.84
[framework/web/wrt-plugins-tizen.git] / src / platform / Tizen / Contact / query-svc / query-svc.c
index 6a7d2cf..e8b16b4 100755 (executable)
@@ -2746,9 +2746,9 @@ API query_error fetch_next_row(ADVANCED_HANDLE handle)
 
                                if(q_handle->next_count != 0)
                                {
-                                       ADVANCED_CATCH_SET_ERROR(((q_handle->category_pos + q_handle->next_count) < q_handle->category_total_count), {}, QUERY_NO_RECORD, ("no record"));
-                                       ADVANCED_CATCH_SET_ERROR((q_handle->category[q_handle->category_pos + q_handle->next_count].sibling != 0), {}, QUERY_NO_RECORD, ("no record"));
-                                       q_handle->category_pos = q_handle->category_pos + q_handle->next_count;
+                                       ADVANCED_CATCH_SET_ERROR(((q_handle->category_pos + 1) < q_handle->category_total_count), {}, QUERY_NO_RECORD, ("no record"));
+                                       ADVANCED_CATCH_SET_ERROR((q_handle->category[q_handle->category_pos + 1].sibling != 0), {}, QUERY_NO_RECORD, ("no record"));
+                                       q_handle->category_pos++;
                                        q_handle->next_count++;
                                        return QUERY_SUCCESS;
                                }else
@@ -2768,6 +2768,8 @@ API query_error fetch_next_row(ADVANCED_HANDLE handle)
                                                        low = j + 1;
                                                else if(q_handle->category[j].contact_id == contact_id)
                                                {
+                                                       while(j > 0 && q_handle->category[j-1].contact_id == contact_id)
+                                                               j--;
                                                        q_handle->category_pos = j;
                                                        q_handle->next_count++;
                                                        return QUERY_SUCCESS;