Skip to Content.
Sympa Menu

freetds - Re: [freetds] DBD::ODBC (perl) and SQLDescribeParam

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] DBD::ODBC (perl) and SQLDescribeParam
  • Date: Mon, 27 Jul 2009 23:06:23 -0400

Michael Higgins wrote:
>
> Without SQLDescribeParam, DBD::ODBC, doesn't know how to cast so to bind
> place holders (?) and SQL Server 2000 (for example) throws an error on
> some columns when preparing a statement. Like the 'money' data_type.
...
> Default data_type is wrong (s/b like, decimal anyway), I hear, because
> there's nothing from the driver to tell us what it is. No
> SQLDescribeParam, so the prepare call always fails. (I'd like to think
> there was something else returned that would provide the column data
> type when preparing a statement, but I can't make sense of any of this
> code -- and this is just what I've been told.)

http://msdn.microsoft.com/en-us/library/ms710963(VS.85).aspx

At the ODBC level, SQLBindParameter takes two datatype descriptors:

ValueType [Input] The C data type of the parameter.
ParameterType [Input] The SQL data type of the parameter.

http://search.cpan.org/~mjevans/DBD-ODBC-1.22/ODBC.pm#odbc_default_bind_type
http://search.cpan.org/~timb/DBI-1.609/DBI.pm#bind_param

You can call DBI->bind_param with a third argument to indicate the SQL
datatype.

> So is there any current development to get this API hook, or whatever it
> is called, implemented in FreeTDS? I did see it marked TODO...
> "SQLDescribeParam (Sybase seems to require it)".

There are no plans other than waiting for Batman to show up with an SQL
parser, no. The ct-lib API does not require (or permit) the application
to provide the SQL datatype; instead it interrogates the server. Because
only Sybase servers provide that support, FreeTDS's ct-lib parameter
binding doesn't work with Microsoft servers.

HTH.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page