[Re: [RE: [freetds] SQL Query troubles]]

Steven Orton sorton9999 at usa.net
Fri Jan 9 09:47:47 EST 2004


I have never run anything except ODBC compliant apps.  Right now, it would
take me too long to get over the learning curve to use anything else right
now.  I can at a later time though:)  I have nothing else installed right now
either.

  steve---


brian at bruns.com wrote:

> Does it happen with non-ODBC applications?  That is if
> you run it with sqsh, can you reproduce it there as
> well?
> 
> This would help us narrow down the cause.
> 
> Brian
> 
> On Thu, 08 Jan 2004 16:17:57 -0500, Steven Orton wrote:
> 
> > 
> > so far its occured with any client that uses the
> > freeTDS driver and sends SQL
> > commands.  So it happens using my client and
> OpenLink's
> > odbctest application. 
> > I can't see anything in my dump logfile that indicates
> > an error condition (no
> > explicit ERROR indicater).  It just hangs with the
> > output log indicating it
> > sent the out packet and where it normally dumps the
> > reply packet, there is
> > nothing.  Is there any other "thing" I can use to see
> > anything else?
> > 
> >   steve---
> > 
> > 
> > 
> > brian at bruns.com wrote:
> > 
> > > All this misses the point of course, which is that
> > > FreeTDS is oblivious to using DISTINCT or any other
> > SQL
> > > construct.  All it care about are the number and
> types
> > > of columns/rows coming back.  This problem if it
> lies
> > > within FreeTDS should be reproducible with the
> simple
> > > "SELECT * from table1 where Target_ID=:C" (:C being
> > > some constant normally returned from the subquery.
> > > 
> > > Perhaps some action within the application has left
> > the
> > > TDS connection in a bizarre state.  See if you can
> get
> > > this to reproduce on a smaller scale maybe? (that
> is,
> > > cut the code down to the barest essentials while
> > having
> > > it still fail).
> > > 
> > > Brian
> > > 
> > > On Thu, 08 Jan 2004 11:18:42 -0800, Michael Peppler
> > > wrote:
> > > 
> > > > 
> > > > On Thu, 2004-01-08 at 11:08, Lowden, James K
> wrote:
> > > > > > From: Steven Orton [mailto:sorton9999 at usa.net]
> > > > > > Sent: January 8, 2004 1:57 PM
> > > > > > 
> > > > > >   I seem to be having problems with the
> > following
> > > > query:
> > > > > > 
> > > > > >   SELECT * FROM table1 WHERE Target_ID=(SELECT
> > > > DISTINCT 
> > > > > > Target_ID FROM table2
> > > > > > WHERE PlatformTypeID=62 AND db_ctx_id=3)
> > > > > 
> > > > > It's not a good idea to rely on a subquery
> > returning
> > > > only one row to a point
> > > > > evaluation.  How do you expect the server to
> cope
> > if
> > > > it returns two
> > > > > (distinct) Target_IDs?  
> > > > > 
> > > > > I would do:
> > > > > 
> > > > > SELECT * FROM table1 
> > > > > WHERE Target_ID in (
> > > > > 	SELECT DISTINCT Target_ID 
> > > > > 	FROM table2
> > > > > 	WHERE PlatformTypeID=62 
> > > > > 	AND db_ctx_id=3
> > > > > 	)
> > > > 
> > > > In general using a join rather than a sub-query
> gets
> > > > better performance:
> > > > 
> > > > select * 
> > > >   from table1 t1
> > > >      , table2 t2
> > > >  where t1.TargetID = t2.TargetID
> > > >    and t2.PlatformTypeID = 62
> > > >    and t2.db_ctx_id = 3
> > > > 
> > > > Michael
> > > > -- 
> > > > Michael Peppler                              Data
> > > > Migrations, Inc.
> > > > mpeppler at peppler.org                
> > > > http://www.mbay.net/~mpeppler
> > > > Sybase T-SQL/OpenClient/OpenServer/C/Perl
> developer
> > > > available for short or 
> > > > long term contract positions -
> > > > http://www.mbay.net/~mpeppler/resume.html
> > > > _______________________________________________
> > > > FreeTDS mailing list
> > > > FreeTDS at lists.ibiblio.org
> > > > http://lists.ibiblio.org/mailman/listinfo/freetds
> > > _______________________________________________
> > > FreeTDS mailing list
> > > FreeTDS at lists.ibiblio.org
> > > http://lists.ibiblio.org/mailman/listinfo/freetds
> > > 
> > 
> > 
> > 
> > -------------------------------
> > Steven Orton
> > sorton9999 at usa.net
> > --
> > "Put your hand on a hot stove for a minute,
> >  and it seems like an hour.
> >  Sit with a pretty girl for an hour, and it
> >  seems like a minute. THAT'S relativity."
> >         -- Albert Einstein
> > -------------------------------
> > 
> > 
> > _______________________________________________
> > FreeTDS mailing list
> > FreeTDS at lists.ibiblio.org
> > http://lists.ibiblio.org/mailman/listinfo/freetds
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
> 



-------------------------------
Steven Orton
sorton9999 at usa.net
--
"Put your hand on a hot stove for a minute,
 and it seems like an hour.
 Sit with a pretty girl for an hour, and it
 seems like a minute. THAT'S relativity."
        -- Albert Einstein
-------------------------------





More information about the FreeTDS mailing list