Liu_Ld
February 2, 2015, 9:13am
1
Below are part example codes for function “as_record_set_map” in file as_record.h :
as_map map;
as_stringmap_init (&map);
as_stringmap_set_int64(&map, “a”, 1);
as_stringmap_set_int64(&map, “b”, 2);
as_stringmap_set_int64(&map, “c”, 3);
But i cannot find where “as_stringmap_init” defined (C Client API: Aerospike C Client ).
Any idea? Thanks
wchu
February 3, 2015, 12:46am
2
This is actually documentation mistake.
The comment/code should be:
as_hashmap map;
as_hashmap_init(&map, 32);
as_stringmap_set_int64(&map, "a", 1);
as_stringmap_set_int64(&map, "b", 2);
as_stringmap_set_int64(&map, "c", 3);
The as_stringmap_xxx functions are purely helper functions for easily inserting a hashmap entry that has string as a key, instead of needing to create as_val and go through the following API:
int as_hashmap_set(as_hashmap * map, const as_val * key, const as_val * val);
Thanks for pointing this out. We will make documentation correction.
Liu_Ld
February 3, 2015, 6:16am
3
Thanks . It works with add a type cast :
as_map *p_map = (as_map *)↦