Search Postgresql Archives

BUG in Prepared transactions from C code using JSON

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



i've got table with json field.

i'm trying to insert from C function some json data.
i'm using SPI_execute_plan function to do this.

json data prepared with StringInfo
simple example:

StringInfo Message = makeStringInfo();

appendStringInfoString(Message, "{\"Command\":227,\"Status\":2,\"JobId\":4"});
Datum Values[2];

Values[0] = Int32GetDatum(227);
Values[1] = CStringGetDatum(Message->data);

ret = SPI_execute_plan(PreparedTr, Values, NULL, false, 0);

if (ret > 0 && SPI_tuptable != NULL && SPI_processed){
///// Data inserted 
}

after selection inserted data looks like 

 "Command":227,"Status":2,"JobId":4}

first { simboll is lost....

Arsen





--
Арсен Арутюнян

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux