[freetds] ODBC: { ? = CALL myproc() }

ZIGLIO Frediano Frediano.Ziglio at vodafoneomnitel.it
Wed Apr 16 02:27:31 EDT 2003


> 
> I've got a problem using ODBC CALL syntax with inout bound 
> parameters to get
> at a stored procedure's return value.  
> 
> I'm using...
> 
> Linux:     Gentoo 1.4
> MSSQL:     7.0sp2
> unixODBC:  2.0.6
> FreeTDS:   0.61
> Perl:      5.8.0
> DBI:       1.35
> DBD::ODBC: 1.05
> 
> I've got 3 different variations on the same thing that have different
> outcomes:
> o  syntax error on valid syntax
> o  segmentation fault on valid syntax
> o  no error, but unexpected result
> 
> 1) If I create a stored procedure:
> 
>   create procedure odbc_call as return 1
> 
> and a perl script:
> 
> #!usr/bin/perl -w
> use DBI;
> my $rv = 0;
> my $dbh = DBI->connect(
>     'dbi:ODBC:ServerName=RD_Q;Driver=TDS;Database=SPCentral',
>     'sa', 'mypasswd',
>     {RaiseError => 1, AutoCommit => 1}
> ) or die DBI->errstr;
> $dbh->trace(1);
> my $sth = $dbh->prepare('{ ? = call odbc_call() }');

Syntax is wrong, use {?=call odbc_call()}. Documentation say nothing about space...

> 
> 2) If I alter the prepared statement to remove all 
> unnecessary whitespace:
> 
>   {?=call odbc_call()}
> 
> I get a segmentation fault. The segfault goes away if I:
> o  place a space between the opening '{' and '?'
>    { ?=call odbc_call()}
> o  alter the stored proc to return a result set
>    create procedure odbc_call as select 1 return 1
>
...

I'll look deepeer..

freddy77



More information about the FreeTDS mailing list