November 22nd, 2013, 04:23 AM
How to get data from table and use in c++ code.
I have a postgress table and can input to it from my code but i also want to get data out of the database to use.
Can someone please point me in the right direction:
My data base has 2 columns. netmask and id.
if i request a certain id i would like returned the netmask?
I think i use the SQL command
PQexec("SELECT ( SELECT netmasks WHERE ID = 3) FROM netmasks;")
But it does not return a string only a result pointer?
November 23rd, 2013, 09:51 AM
SELECT queries always return a resultset and in your case you are selecting a record inside a record.
I think your query should probably be:
SELECT * FROM netmasks WHERE ID=3
The semicolon at the end is not required and it is generally less bugsensitive if you leave it out.
Last edited by Vinny42; November 23rd, 2013 at 09:55 AM.