mdb->row_number = -1;
mdb->field_number = -1;
- if (mdb->result != NULL) {
+ if (mdb->result) {
PQclear(mdb->result); /* hmm, someone forgot to free?? */
+ mdb->result = NULL;
}
Dmsg1(500, "my_postgresql_query starts with '%s'\n", query);
mdb->num_fields = (int) PQnfields(mdb->result);
Dmsg1(500, "we have %d fields\n", mdb->num_fields);
- mdb->num_rows = PQntuples(mdb->result);
+ mdb->num_rows = PQntuples(mdb->result);
Dmsg1(500, "we have %d rows\n", mdb->num_rows);
mdb->status = 0;