I have code like below (it's partial, ofcourse). I can connect sucessfully to the database, I can do INSERT INTO
and all that stuff, but the result of SELECT FROM
never can be displayed.
snprintf(sqlSelect, sizeof(sqlSelect), "select * from %s", sqlTableName);
res = PQexec(conn, sqlSelect);
if (PQresultStatus(res) != PGRES_TUPLES_OK) {
fprintf(stderr, "SELECT FROM failed: %s", PQerrorMessage(conn));
PQclear(res);
exitNicely(conn);
}
PQclear(res);
Why above code doesn't print SELECT * FROM db_name
result in the terminal?