[freetds] First select fails on newly created/populated table fails

Carl Edwards edwards at vitesse.com
Wed Apr 9 19:43:43 EDT 2003


I had a very similar problem doing a SELECT followed
by an UPDATE using perl and DBI.

In .60 this was causing core dumps but in .61 it turned
out that the first time it only executed the SELECT and
each time after just the UPDATE???

I e-mailed the list a few times but never resolved 
the problem, I eventually changed my SQL to just
do one UPDATE.

Unfortunately I cannot make heads or tails of the
return code from my $dbh->do("UPDATE ... so it is
really hard to tell the difference between an error
and a failed WHERE match.

Good luck,
-Carl Edwards


> -----Original Message-----
> From: Richard Rowell [mailto:richard at bowmansystems.com]
> Sent: Tuesday, April 08, 2003 12:21 PM
> To: freetds at lists.ibiblio.org
> Cc: Brent Dooley
> Subject: [freetds] First select fails on newly created/populated table
> fails
> 
> 
> I create a table and insert rows into it.  The first time I 
> do a select
> the select returns nothing, not even the "0 rows affected" 
> (even though
> it should return two rows).  The exact same select repeated works the
> second time and every time thereafter.  Snip for SQSH:
> 
> 1> create table ttest ( name varchar(50))
> 2> insert into ttest values ( 'rick');
> 3> insert into ttest values ( 'dave');
> 4> go
> 1> select * from ttest where name = 'rick'
> 2> go
> 1> select * from ttest where name = 'rick'
> 2> go
>  name                                              
>  --------------------------------------------------
>  rick                                              
> 
> (1 row affected)
> 
> I have played with this for the last two hours isolating it.  Here are
> some observations I have made:
> 1.  If you drop the where clause, it works as expected (the 
> first time.)
> 2.  If you drop the second go it works as expected.  
> 3.  If you only do one insert instead of two it works as expected.  
> 4.  Behaves the same with regular or temporary tables.
> 5.  The exact same SQL works as expected when using Query 
> Analyzer from
> Windows 2k.  
> 
> I'm attaching the pertinent portion of the log file also.
> 
> Environment:
> sqsh 2.1-5 (but it does the same thing under PHP4.2.3 which 
> is where we
> originally noticed it)
> freetds/libct : 0.61-2 (Debian unstable)
> Debian Testing/Unstable on i386
> SQL Server 2000 Service Pack 2
> 



More information about the FreeTDS mailing list