Examples with variables [Resolved]


#1

Hi All the examples that are provided uses constant values in the api as_record_set_str. I am not able to set a string in the aerospike database using variables in it.

code:

string strToCpy2=string(“Asif_test”);

printf(" Att. %s Value to set: %s",attName,strToCpy2);

as_record_set_str(rec, attName,strToCpy2.c_str());

o/p:

Att. DEFCMD Value to set: Asif_test Att. DEFMODE Value to set: Asif_test Att. EXENAME Value to set: Asif_test Att. GNAME Value to set: Asif_test Att. NAME Value to set: Asif_test Att. STOPCMD Value to set: Asif_test Att. STOPMODE Value to set: Asif_test Att. STRTCMD Value to set: Asif_test Att. STRTMODE Value to set: Asif_test Att. UNAME Value to set: Asif_test Att. ARGS Value to set: Asif_test

In Database, string values are all corrupted while Integers are all OK

aql> select * from pfmconfig.sep ±----±-------±--------±--------±------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±—±-----±------±---------±-----±—+ | CPU | DEFCMD | DEFMODE | EXENAME | GNAME | GRPREF00 | GRPREF01 | GRPREF02 | GRPREF03 | GRPREF04 | GRPREF05 | GRPREF06 | GRPREF07 | GRPREF08 | GRPREF09 | GRPREF10 | GRPREF11 | GRPREF12 | GRPREF13 | GRPREF14 | GRPREF15 | GRPREF16 | GRPREF17 | GRPREF18 | GRPREF19 | HOST_REF | ID | NAME | NDIAL | PRIORITY | RATE | RI | ±----±-------±--------±--------±------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±—±-----±------±---------±-----±—+ | 0 | “€¦2” | “€¦2” | “€¦2” | “” | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | “” | 100 | 4 | 100 | 1 | ±----±-------±--------±--------±------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±---------±—±-----±------±---------±-----±—+ 1 row in set (0.067 secs)

Please suggest.


#2

Its done. No need to reply.