Newbee to databases (ODBC)

From: "Malm Paul" <paul(dot)malm(at)saabgroup(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Newbee to databases (ODBC)
Date: 2008-01-21 15:19:28
Message-ID: 9103513CAFE9554496DD17054510B6DF0114E978@corpappl002.corp.saab.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,
I'm sorry to bother you with this question, I know it is a C++ ODBC
question. But I'm a bit desperate.
Perhaps I'll be lucky.

I have a table with 2 columns no_char and blobdata were no_char is
number of characters in blobdata. I would like to handle each row from
the result set.

I have got this far:

//Setup selectstatement
strcpy((char*) SQLStmt, "Select no_char, blobdata from tab1");

//Execute the statement
rc = SQLExecDirect(dbConnection.StmtHandle, SQLStmt, SQL_NTS);

//Define what to read out from the selection set
rc =SQLBindCol(StmtHandle, 1 SQL_C_LONG, (SQLPOINTER) &no, sizeOf(no),
NULL);
rc =SQLBindCol(StmtHandle, 2 SQL_C_BINARY, (SQLPOINTER) blob, no, NULL);

// get the values
while(SQLFetch(StmtHandle) != SQL_NO_DATA)
{
...
...
}

But this will not work since I'm using "no" in the second statement to
define the blob size, and no is not set yet.
I could solve it by using 2 different select statemen (once for the size
and one for the blob) but that seems to be a bad solution.

Sorry again!
/Paul

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-01-21 15:33:13 Re: [GENERAL] SHA1 on postgres 8.3
Previous Message Magnus Hagander 2008-01-21 15:18:01 Re: PG-8.2 backup strategies