From 9a98086e25c0da19e38103c327f7266cfb666066 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Mon, 8 Oct 2012 18:54:16 +0000 Subject: [PATCH] Convert floats to native objects as well. FossilOrigin-Name: 7a033e34c4e334f5b663b7c5e2f10eb8e3fe9a8a0de96a64b352fc4a1e37b410 --- PGResultRow.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/PGResultRow.m b/PGResultRow.m index 880595c..15da69b 100644 --- a/PGResultRow.m +++ b/PGResultRow.m @@ -4,17 +4,21 @@ static id convert_type(PGresult *res, int col, OFString *str) { switch (PQftype(res, col)) { - case 16: /* BOOLOID */ + case 16: /* BOOLOID */ if ([str isEqual: @"t"]) return [OFNumber numberWithBool: YES]; else return [OFNumber numberWithBool: NO]; - case 21: /* INT2OID */ + case 21: /* INT2OID */ return [OFNumber numberWithInt16: (int16_t)[str decimalValue]]; - case 23: /* INT4OID */ + case 23: /* INT4OID */ return [OFNumber numberWithInt32: (int32_t)[str decimalValue]]; - case 20: /* INT8OID */ + case 20: /* INT8OID */ return [OFNumber numberWithInt64: (int64_t)[str decimalValue]]; + case 700: /* FLOAT4OID */ + return [OFNumber numberWithFloat: [str floatValue]]; + case 701: /* FLOAT8OID */ + return [OFNumber numberWithDouble: [str doubleValue]]; } return str;