diff options
Diffstat (limited to 'sql')
| -rw-r--r-- | sql/serenitas.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sql/serenitas.c b/sql/serenitas.c index f21a55c3..428950dc 100644 --- a/sql/serenitas.c +++ b/sql/serenitas.c @@ -157,13 +157,12 @@ Datum upfront_from_level(PG_FUNCTION_ARGS) { if (SPI_connect() == SPI_ERROR_CONNECT) { elog(ERROR, "something wrong happened"); } - elog(INFO, "pomme"); const text* redindexcode = PG_GETARG_TEXT_PP(0); DateADT maturity = PG_GETARG_DATEADT(1); float8 traded_level = PG_GETARG_FLOAT8(2); DateADT trade_date = PG_GETARG_DATEADT(3); const char* currency = text_to_cstring(PG_GETARG_TEXT_PP(4)); - char* sql_query = "SELECT index, coupon, issue_date, indexfactor/100, cumulativeloss " + char* sql_query = "SELECT index::text, coupon, issue_date, indexfactor/100, cumulativeloss " "FROM index_desc " "WHERE redindexcode=$1 AND maturity=$2"; uint64 proc; @@ -176,7 +175,6 @@ Datum upfront_from_level(PG_FUNCTION_ARGS) { values[1] = DateADTGetDatum(maturity); ret = SPI_execute_with_args(sql_query, nargs, argtypes, values, nulls, true, 1); proc = SPI_processed; - int coupon; char *index; TDate issue_date; @@ -195,7 +193,6 @@ Datum upfront_from_level(PG_FUNCTION_ARGS) { SPI_finish(); elog(ERROR, "something wrong happened"); } - elog(INFO, "salut"); int16 curve_type = 532; sql_query = "SELECT curve FROM rate_curves WHERE effective_date=$1 AND curve_type=$2"; argtypes[0] = DATEOID; @@ -218,10 +215,9 @@ Datum upfront_from_level(PG_FUNCTION_ARGS) { SPI_finish(); elog(ERROR, "no curve for that date"); } else { - elog(INFO, "poupou"); buf = DatumGetByteaPP(tmp); - uint32 data_length = VARSIZE_ANY(curve); - char *raw_data = VARDATA_ANY(curve); + uint32 data_length = VARSIZE_ANY(buf); + char *raw_data = VARDATA_ANY(buf); curve = (TCurve*)malloc(512); get_TCurve(raw_data, data_length, curve); } |
