[freetds] placeholders and messages

Frediano Ziglio freddyz77 at tin.it
Wed Apr 6 13:49:56 EDT 2005


Il giorno mer, 06-04-2005 alle 12:26 -0400, Lowden, James K ha scritto:
> > 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....
> 

Which problem ??

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

:( 
A complex mix for error and resultsets...
James, post odbc and freetds logs.

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

Well from bcp.c:

	printf("BILL fread failed after fseek\n");

what a funny code :)

freddy77




More information about the FreeTDS mailing list