]> granicus.if.org Git - pdns/commitdiff
Handle booleans correctly in gPGSql
authorAki Tuomi <cmouse@cmouse.fi>
Sat, 12 Sep 2015 20:48:56 +0000 (23:48 +0300)
committerAki Tuomi <cmouse@cmouse.fi>
Sat, 12 Sep 2015 20:48:56 +0000 (23:48 +0300)
modules/gpgsqlbackend/spgsql.cc

index bcb1c7bda72ddbbf2a070ce5b67cbbdb817492d8..b6aa597f5f478dab27a6a7342fa35cb41ffbde92 100644 (file)
@@ -91,6 +91,9 @@ public:
     for(i=0;i<PQnfields(d_res);i++) {
       if (PQgetisnull(d_res, d_residx, i)) {
         row.push_back("");
+      } else if (PQftype(d_res, i) == 16) { // BOOLEAN
+        char *val = PQgetvalue(d_res, d_residx, i);
+        row.push_back(val[0] == 't' ? "1" : "0");
       } else {
         row.push_back(string(PQgetvalue(d_res, d_residx, i)));
       }