freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] Question about FreeTDS odbc.c and SQL_ATTR_ROW_BIND_TYPE
- From: "Steve Murphree" <smurph AT smcomp.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Question about FreeTDS odbc.c and SQL_ATTR_ROW_BIND_TYPE
- Date: Fri, 27 Jun 2003 15:28:18 -0700
Ramon,
There is a patch at the FreeTDS sourceforge site that introduces a whole new
odbc driver called libmsodbc. It might still apply against -current. This
will eliminate your application from bombing because the
SQL_ATTR_ROW_BIND_TYPE attribute is supported for SQL_BIND_BY_COLUMN, but
only SQL_BIND_BY_COLUMN. Binding a row into a buffer or structure is not
yet supported. If you are handy at applying patches then this might be a
alternative. freetds.conf is not used with libmsodbc and it also contains a
unixODBC setup function. libmsodbc.so should be both your driver lib and
your setup lib. Use ODBCConfig to set up your DSN after libmsodbc is
installed to see all of the driver settings. Most duplicate the settings
that are in freetds.conf so you can use it's values for the new drivers
settings.
To modify your existing FreeTDS code, simply add the SQL_ATTR_ROW_BIND_TYPE
attribute in the case statement and just do nothing if the value of the
attribute is SQL_BIND_BY_COLUMN. Again, only SQL_BIND_BY_COLUMN is
implemented in the current driver, so a value other than SQL_BIND_BY_COLUMN
should return the HYC00 "Driver Not Capable" error. Heh, because it isn't.
:-)
Also, according to the ODBC API, SQL_BIND_BY_COLUMN is the default row bind
type. If the a driver conforms to the ODBC API, setting this attribute to
SQL_BIND_BY_COLUMN is not needed. You might take out your call to
SQLSetStmtAttr() and the application will most likely survive with other
ODBC API compliant drivers also.
The ODBC APT can be found at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od
bcstartpage1.asp
>From the ODBC API:
"An SQLUINTEGER value that sets the binding orientation to be used when
SQLFetch or SQLFetchScroll is called on the associated statement.
Column-wise binding is selected by setting the value to SQL_BIND_BY_COLUMN.
Row-wise binding is selected by setting the value to the length of a
structure or an instance of a buffer into which result columns will be
bound."
"If a length is specified, it must include space for all of the bound
columns and any padding of the structure or buffer to ensure that when the
address of a bound column is incremented with the specified length, the
result will point to the beginning of the same column in the next row. When
using the sizeof operator with structures or unions in ANSI C, this behavior
is guaranteed."
"Column-wise binding is the default binding orientation for SQLFetch and
SQLFetchScroll."
Steve
----- Original Message -----
From: "Arjona, Ramon" <Ramon.Arjona AT wizards.com>
To: <freetds AT lists.ibiblio.org>
Sent: Friday, June 27, 2003 11:10 AM
Subject: [freetds] Question about FreeTDS odbc.c and SQL_ATTR_ROW_BIND_TYPE
> Hi,
>
> I'm using FreeTDS version 0.61 on Red Hat Linux with version 2.2.2 of
> unixODBC. I'm connecting to an MS SQL 2000 box using TDSVER=8.0.
> The application we're running is written in C/C++.
>
> The problem that I am having is this: I am attempting to call
> SQLSetStmtAttr as follows:
>
> stat = SQLSetStmtAttr(mycmd, SQL_ATTR_ROW_BIND_TYPE, SQL_BIND_BY_COLUMN,
> 0);
>
> This falls through into SQLSetStmtOption in odbc.c. This function then
> falls through to the error handler, logging the message that
> "odbc:SQLSetStmtOption: Statment option 5 not implemented" which in turn
> causes the application to dump core.
>
> My questions are as follows:
>
> 1) What should be the appropriate idiom to work around this problem in
> FreeTDS? Should I just comment out the set attribute statement or is
> there some other approach I ought to take.
>
> 2) If I were to attack the problem at odbc.c itself and attempt to
> implement this function & option, can anyone reccomend a set of useful
> reference documentation?
>
> Any input is appreciated.
>
> Thank you,
> Ramon
>
>
>
> The Master says, 'Man who falls in vat of molten glass makes spectacle
> of himself.'
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>
-
[freetds] Question about FreeTDS odbc.c and SQL_ATTR_ROW_BIND_TYPE,
Arjona, Ramon, 06/27/2003
- Re: [freetds] Question about FreeTDS odbc.c and SQL_ATTR_ROW_BIND_TYPE, Steve Murphree, 06/27/2003
Archive powered by MHonArc 2.6.24.