Helper functions to deal with data fetching
There are other helper functions that help you retrieve the results. Let's go through these functions one by one:
pg_free_results
Using the pg_free_results
function, we can clear the memory resources that are used to hold the result set. All the data retrieval functions we used earlier occupy a certain amount of memory to hold the result set. It is a good practice to clear the result set after we are done processing the query results.
pg_num_rows
Using the pg_num_rows
function, we can get the number of tuples in the result set. That is, if we execute a query, it returns the number of tuples the SELECT
query has fetched from the database.
pg_num_fields
Using the pg_num_fields
function, we can get the number of columns or fields in the result set. That is, it returns the number of columns we mentioned in the SELECT
query.
pg_field_name
Using pg_field_name
function, we can get the field name that we mentioned in the SELECT
query. This...