473,326 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Usisng PQgetvalue

39
Hi I am using PQgetvalue() function in c to get the value like

PQgetvalue(result,0,2)

but the program outputs

column number 2 is out of range 0..0

Can someone tell me how can I get this field and whats wrong?

Thanks
Apr 29 '07 #1
2 6655
michaelb
534 Expert 512MB
Did you check what this query actually returns?
Both, row and column numbers are zero-based, so it has to return at least three columns.

You can use PQntuples and PQnfields to check whether you get any rows, and if so how many columns are there, or perhaps you could just execute the same query via psql or any other interface like pgAdmin.

Returns the number of rows in the query result.
int PQntuples(const PGresult *res);
-- -- --
Returns the number of columns (fields) in each row of the query result.
int PQnfields(const PGresult *res);
Apr 30 '07 #2
atlkhan
39
Thanks man , I just realized that my query wasn't retruning the 3rd column.
May 1 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Adam Kavan | last post by:
I decided to try pg_autovacuum and am having a problem. It never analyzes or vacuums. I looked at the code and had it display printf("%s,%s,%s\n",PQgetvalue(res, j, PQfnumber(res,...
1
by: Laszlo | last post by:
Hi all, As a novice I installed PostgreSQL 7.2.1 on Win32 and works, Borland C++Builder Enterprise Suite 5.0 (build 12.34) what works too. I decided to combine these two programs and develop a...
3
by: Dave Smith | last post by:
I am running 7.2.4 and when running a vacuum on my database I get NOTICE: Child itemid in update-chain marked as unused - can't continue repair_frag ERROR: No one parent tuple was found...
3
by: Ryan Riehle | last post by:
Hi All! Trying to upgrade to Apache 2.0.49 and getting compile errors related to mod_auth_pgsql, any clue?: make: Entering directory `/usr/src/httpd-2.0.49'...
3
by: Scott Ribe | last post by:
I'm using 7.3.2, invoke a small stored procedure via PQexec, and PQresultStatus returns PGRES_NONFATAL_ERROR. I can find nothing in the docs to help me understand what could cause this, and...
1
by: Vikram | last post by:
Hello All, Im novice to Postgres ,Im trying to program in 'libpq the C application programmer's interface to PostgreSQL' I was trying to execute sample 'testlibpq.c'. I did the following......
2
by: Bastian Voigt | last post by:
Hallo List! I just found this old posting on google. Now my question is how can I read an integer value from the PGresult using the binary format? Can someone plz gimme a code example? (please...
0
by: Douglas Lochart | last post by:
Hey all, First off I am new to postgres and multi-lingual development so pardon me if the answer is overly obvious. We our database is setup for UNICODE. We have a mixture of clients...
19
by: werdan | last post by:
G'day all I'm bitmapping integers to store combined boolean values and have hit a bit of a snag. I want to be able to turn off certain bits if they they match in a number but not turn them on...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.