From 9701da59c11be7152ecca5171d676e075539fc22 Mon Sep 17 00:00:00 2001 From: Dmitri Pal Date: Fri, 4 Sep 2009 20:28:06 -0400 Subject: COLLECTION Copy collection flat with concatenated names This patch addresses several issues: a) Adds capability to add or copy the collections in flattened mode but construct names of attributes in dotted notation. For example when you append collection "sub" with items "foo" and "bar" previously you could add them as "foo" and "bar" not you can flatten them and the names will be "sub.foo" and "sub.bar" this allows better processing of the attributes in the elapi message. b) Removes old implemntation of the copy collection function. c) Removes the col_set_timestamp, this functionality has been moved to ELAPI long ago. d) Updates collection unit test. e) Updates elapi to use new functionality f) Updates elapi unit test Have run under valgrind with no problems. --- collection/collection_ut.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'collection/collection_ut.c') diff --git a/collection/collection_ut.c b/collection/collection_ut.c index 6d913f9..3666179 100644 --- a/collection/collection_ut.c +++ b/collection/collection_ut.c @@ -283,7 +283,7 @@ int mixed_collection_test(void) col_debug_collection(socket1, COL_TRAVERSE_DEFAULT); printf("Creating a copy of SOCKET1 collection named SOCKET2.\n"); - error = col_copy_collection(&socket2, socket1, "socket2"); + error = col_copy_collection(&socket2, socket1, "socket2", COL_COPY_NORMAL); if (error) { col_destroy_collection(peer); col_destroy_collection(host); @@ -640,7 +640,7 @@ int iterator_test(void) return error; } - error = col_add_collection_to_collection(peer, NULL, "forth", socket1, COL_ADD_MODE_EMBED); + error = col_add_collection_to_collection(peer, NULL, "forth", socket1, COL_ADD_MODE_FLATDOT); if (error) { col_destroy_collection(peer); col_destroy_collection(socket1); @@ -648,6 +648,16 @@ int iterator_test(void) return error; } + error = col_add_collection_to_collection(peer, NULL, NULL, socket1, COL_ADD_MODE_FLATDOT); + if (error) { + col_destroy_collection(peer); + col_destroy_collection(socket1); + printf("Failed to add collection to collection. Error %d\n", error); + return error; + } + + col_destroy_collection(socket1); + /* Bind iterator */ error = col_bind_iterator(&iterator, peer, COL_TRAVERSE_DEFAULT); if (error) { -- cgit