Skip to Content.
Sympa Menu

freetds - RE: [freetds] placeholders and messages

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: <ml AT freetds.org>
  • Cc:
  • Subject: RE: [freetds] placeholders and messages
  • Date: Wed, 6 Apr 2005 17:20:04 -0400

> From: Frediano Ziglio
> Sent: Wednesday, April 06, 2005 1:50 PM
>
> Il giorno mer, 06-04-2005 alle 12:26 -0400, Lowden, James K ha
scritto:
> >
> > I discovered two things.
> >
> > 1. There seems to be a recognized problem binding datetimes with
> > DBD::ODBC. It doesn't work with my odbc_rpc.pl, and I saw a few
> > references at ActiveState on the same topic. Should be fixable,
> > theoretically....
>
> Which problem ??

http://www.opensubscriber.com/message/perl-win32-users AT listserv.ActiveSt
ate.com/108164.html

I think I misunderstood the purpose of the datatype parameter to
bind_param(). I thought it described the parameter type. No, it
describes the buffer to which the parameter is being bound. Perl has
only strings and integers, so it's a mistake to tell bind_param() that
my Perl variable is a DATETIME.

I get the same message from the same script on a Windows box:

$ perl odbc_rpc.pl -D "DBI:ODBC:mpq" -U abc -P abc
GenerationsAddParsed expann ":SQL_DATETIME:2005-04-01 16:46:00"
:SQL_INTEGER:0
3 arguments found for procedure "GenerationsAddParsed"
Binding parameter #1, the return code
Binding parameter #2 (SQL_VARCHAR): "expann"
Binding parameter #3 (SQL_DATETIME): "2005-04-01 16:46:00"
Binding parameter #4 (SQL_INTEGER): "0"

Executing: "{? = call GenerationsAddParsed (?, ?, ?)}" with parameters
'expann', ':SQL_DATETIME:2005-04-01 16:46:00', ':SQL_INTEGER:0'
Can't rebind placeholder 3 at odbc_rpc.pl line 85.

Only later did it dawn on my to try passing the date as a string, which
worked fine, even without altering the stored procedure.

> > 2. We still have issues with error messages, even in current CVS.
> > Consider this stored procedure:
> >
> > create proc t
> > as begin
> > select 'Here is the first row' as FirstResult
> > raiserror( 'This is an example error message.', 16, 1)
> > select 'Here is the last row' as LastResult
> > end
> >
> > We should see one message and two results (one row each). But here
is
> > today's surprise answer:
> >
> > $ ./samples/odbc_rpc.pl -Ddbi:ODBC:mpq -U$U -P$P t
> > Binding parameter #1, the return code
> >
> > Executing: "{? = call t }" with parameters ''
> > execute returned: '-1'
> > Result #1:
> > [FirstResult]
> > 'Here is the first row'
> > DBD::ODBC::st fetchrow failed: [unixODBC][FreeTDS][SQL Server]This
is an
> > example error message. (SQL-)(DBD: st_fetch/SQLMoreResults err=-1)
at
> > ./samples/odbc_rpc.pl line 94.
> > 'Here is the first row'
> > 'Here is the last row'
>
> :(
> A complex mix for error and resultsets...
> James, post odbc and freetds logs.

Attached (I hope).

I also wrote dblib_rpc.pl, which I'll commit soon too. It demonstrates
that the db-lib rpc code handles server messages just fine. And I'd say
-- can you guess? -- the API is easier to use. Of course, it can only
call stored procedures; it's not as flexible as ODBC's prepare/exeucute.


Regards,

--jkl


-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named
above. If you are not the intended recipient, or an employee or agent
responsible
for delivering this message to the intended recipient, any review,
dissemination,
distribution or duplication of this communication is strictly prohibited. If
you are
not the intended recipient, please contact the sender immediately by reply
e-mail
and destroy all copies of the original message. Please note that we do not
accept
account orders and/or instructions by e-mail, and therefore will not be
responsible
for carrying out such orders and/or instructions. If you, as the intended
recipient
of this message, the purpose of which is to inform and update our clients,
prospects
and consultants of developments relating to our services and products, would
not
like to receive further e-mail correspondence from the sender, please "reply"
to the
sender indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New
York,
NY 10105.

Attachment: dump.odbc
Description: dump.odbc

Attachment: dump
Description: dump




Archive powered by MHonArc 2.6.24.

Top of Page