Skip to Content.
Sympa Menu

freetds - [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: [freetds] placeholders and messages
  • Date: Wed, 6 Apr 2005 12:26:05 -0400

> From: ZIGLIO, Frediano, VF-IT
> Sent: Wednesday, April 06, 2005 3:22 AM
>
> > I just committed samples/odbc_rpc.pl.
> ...
> > If someone could point out what's wrong, I'd appreciate the help.
> >
>
> I think that
>
> my $sql = "{? = call $ARGV[0] $placeholders}";
>
> should be
>
> my $sql = "{? = call $ARGV[0]($placeholders)}";
>
> (note () sorrounding parameters)

No, the statement:

$placeholders = '(' . join( q(, ), @placeholders ) . ')';

wraps the ?'s in parentheses. The problem was *much* stupider: there
were two "prepare" calls. It now (mostly) works.

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....

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'

That is:
1. Resultset 1, Row 1
2. the message
3. Resultset 1, Row 1 (again)
4. Resultset 1, Row 2 (Should be Resultset 2, Row 1)

I also did a little regression testing with 0.62.3. It swallowed the
message, but at least returned the correct results:

Executing: "{? = call t }" with parameters ''
execute returned: '-1'
Result #1:
[FirstResult]
'Here is the first row'
Result #2:
[LastResult]
'Here is the last row'

I don't happen to have 0.63 installed here, but someone reading this
message surely does. I'd be interested to learn what you find.

Ah, Spring. When a young man's fancy turns to thoughts of love of
programming.

--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.




Archive powered by MHonArc 2.6.24.

Top of Page