Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Location
    Germany
    Posts
    2

    Unanswered: Reading binary/int data

    Hi there,
    I am quite new to postgre.
    I need to access postgre databases via c++ using the c-api libpq.
    So far everything was working. I can read fields of type varchar from tables, but I have investigated a problem when I try to read fields of type int4 (for instance).
    When I read using the function PQgetvalue() it returns an empty string though the field is filled. When I call PQfformat() on an int4 row it tells me that the row contains binary data.
    Is that correct and can someone tell me how to read the data correctly?

    Thanks in advance
    Henne

  2. #2
    Join Date
    Apr 2003
    Location
    Tunisia
    Posts
    192

    Thumbs up Lo

    If you're dealing with Large objects or bianries, you must use the Lo , you'll find it in the contrib directory.
    Open up
    Take a look to my Blog http://www.rundom.com/karim2k

  3. #3
    Join Date
    Mar 2004
    Location
    Germany
    Posts
    2
    Hi, Karim,thanks for your answer.
    I got a little bit further. I am not dealing with large objects. I am dealing with fields of type int4 (or integer).
    Are you familiar with the libpq?
    It is just that when I call PQgetvalue() on a text field I get the correct result. When I do this on an integer field I get an empty (non null) result.

  4. #4
    Join Date
    Apr 2003
    Location
    Tunisia
    Posts
    192

    Thumbs up No LibPQ

    Sorry, I havent never got real dealing with LibPq.
    Open up
    Take a look to my Blog http://www.rundom.com/karim2k

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •