Thread: [ psqlodbc-Bugs-1000510 ] Access the rdoResultset´s column is NULL in the second access

Bugs item #1000510, was opened at 27-12-2005 15:20
You can respond by visiting:
http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1000510&group_id=1000125

Category: None
Group: None
Status: Closed
Resolution: Rejected
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: Access the rdoResultset´s column is NULL in the second access

Initial Comment:
In VB's example:

Private Sub QueryTest()

Dim rdoQuery As rdoResultset

Set rdoQuery = InjetDB.OpenResultset("SELECT A || B AS Test FROM pdTable")

If not rdoQuery.EOF Then
    Debug.print(rdoQuery!Test)
    Debug.print(rdoQuery!Test) 'Error happen (Invalid use of NULL)
End If

End Sub


' rdoResultset is Microsoft Remote Data Object 2.0
' Postgree 8.1
' psqlodbc-8_01_0106

----------------------------------------------------------------------

Comment By: Milton Siqueira (miltonsiqueira)
Date: 02-01-2006 20:23

Message:
Hi, Ludek Finstrle!!!

Shortly i will send a compiled example, ok?! your email is  luf@pzkagis.cz?

===========================
pdTable
---------------------------
A(VARCHAR)      B(VARCHAR)
---------------------------
'Field1'        'Field2'
===========================

I already done account(miltonsiqueira), Shall I open the same bug again (now with my login)?


----------------------------------------------------------------------

Comment By: Ludek Finstrle (luf)
Date: 02-01-2006 19:03

Message:
User wrote:
The original posting has a bad assumption. The problem is not the ODBC driver.
When A or B is a NULL, then A || B concatenation returns NULL. The server returns NULL.

Running the a sample from psql, or pgadmin will verify this. It is even
clearer with a query like
SELECT A,B,A||B as C from my_table;

----------------------------------------------------------------------

Comment By: Ludek Finstrle (luf)
Date: 27-12-2005 19:12

Message:
Could you send me compiled example as I have no VB?
How is your pdTable filled? What result return psql client?
Could you send me mylog output (enabled mylog under Global and DataSource button) too?

If you don't create this bug as anonymous you can append this files to the bug report ...

----------------------------------------------------------------------

You can respond by visiting:
http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1000510&group_id=1000125

Re: [ psqlodbc-Bugs-1000510

From
Ludek Finstrle
Date:
> When you click the first time in the button "Column value", i call
> first access. In the second time, i call the second access

The problem was I use "Use Declare/Fetch". I can reproduce the problem now.

I see no problem in psqlODBC driver. ADO use SQLGetData for text.
ODBC API say:
http://msdn.microsoft.com/library/en-us/odbc/htm/odbcsqlgetdata.asp?frame=true
...
1. Returns SQL_NO_DATA if it has already returned all of the data for
   the column.
...

The driver do it right this way. Are you sure you can read the data
more times? Integers and other types are picked up by another way
(SQLBindCol, SQLFetch - integer versus SQLFetch, SQLGetData - text).

Regards,

Luf

P.S. Cc: pgsql-odbc - maybe someone has some idea.