Skip to Content.
Sympa Menu

freetds - Re: [freetds] Problem retrieveing results from a query with an IMAGE field

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: <dveiga AT advtechnology.com.ar>, "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Problem retrieveing results from a query with an IMAGE field
  • Date: Tue, 10 Jun 2008 09:50:53 +0200

>
> Thank you Frediano! With the information provided I managed
> to overcome
> the problem :). I recoded the application to avoid fetching
> columns I'm
> not planning to bind and its working fine now!
>

I wrote a test (cursor6) and the fix. See
http://freetds.sourceforge.net/ for post 0.82 fixes

> Even though its solved for me, I decided to look into the problem
> again. It may seem a bit masochist, but when I'm using
> something free I
> have a feeling of beeing in debt with the people that worked in that.
> Perhaps, I can help ...
>
> To tell you the truth, what I dislike the most about this
> issue is that
> it hangs the underlaying TDS mechanism. When I didn'k know anything
> about what caused the problem, one of my first attempts to
> recover from
> the error was closing the statement and openning another. The new
> allocated statement failed when I tried to use it! So I believe
> something has to be done when unbinding a socket, perhaps "discarding
> unprocessed results" or something alike.
>

Quite strange, a cancel should be issued and connection should be
reset...

> Then I decided to browse the web to see what other drivers did when
> reaching columns that are not bound in a non-unitary rowset fetch. As
> far as I could research there are two cases:
>
> 1) Drivers that support SetPos: They cache data, as the user
> can "move"
> the pointer using SQLSetPos option SQL_POSITION to any row in the
> rowset. This is not the case, at least at this point, of TDS ODBC
> driver, as it clearly reports SQL_CA1_POS_XXXX bits clear in a call to
> SQLGetInfo(SQL_XXXX_CURSOR_ATTRIBUTES1).
>

??? 0.82 should report a value if cursors are supported (currently using
mssql)
I have to review the SQL_POSITION part. Currently it tells the server
which row we want... I never though about SQLGetData and SQL_POSITION...
the problem here is:
- fetch n rows (where N > 1) with some unbinded columns
- use SQL_POSITION
- get data with SQLGetData
questions:
- does client send some commands during SQL_POSITION or only if cursor
name is set ?
- SQLGetData gets correct data?

> 2) Drivers that do not support SetPos: As far as I could research, I
> believe it might be convenient to change the concept of "stopping at
> the first unbound column" by "stopping at the first unbound column OF
> THE LAST ROW RETURNED". This would be compatible with single-row
> rowsets
> and permit retrieveing multiple rows without having to bind
> them all. I
> found Postgresql driver for linux is in this second group, so I did a
> couple of small programs and verified it behaves this way. What do you
> think?
>
> PS: If you, as the project leaders, think this is a minor problem and
> preffer to leave it as it is, just let me know. I won't bother you any
> more with mails. :)
>

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page