List Info

Thread: Re: LIMIT 1 in Select Clause




Re: LIMIT 1 in Select Clause
country flaguser name
Poland
2007-12-04 07:47:42
Sharan Rao said the following, On 2007-12-01 21:17:

>  I was facing problems with the function
Connection::querySingleString() in 
> Sybase, as the " LIMIT " clause is not
supported.

Sharan, thanks for your time; here's the patch you can apply
for LIMIT 1 
ussue. I am looking forward your opinion on it.

BTW, I propose to use kexikde.org mailing list now.
Who knows, maybe there's 
someone interested in tracking the development of the
Sybase/MSSQL driver and 
can provide valuable feedback. (already CC'd).


Information for others: Sharan uses the db-lib from the
FreeTDS project: 
http://www.freetds.org/

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice
.com.pl/en) to work on
  Kexi & KOffice: http://www.kexi.pl/en, http://www.koffice.org
  KDE3 & KDE4 Libraries for MS Windows: http://kdelibs.com, http://www.kde.org

_______________________________________________
Kexi mailing list
Kexikde.org
https://ma
il.kde.org/mailman/listinfo/kexi

  
Re: LIMIT 1 in Select Clause
user name
2007-12-05 08:33:10
On Tuesday 04 Dec 2007 7:17:42 pm Jarosław Staniek wrote:
> Sharan Rao said the following, On 2007-12-01 21:17:
> >  I was facing problems with the function
Connection::querySingleString()
> > in Sybase, as the " LIMIT " clause is
not supported.
>
> Sharan, thanks for your time; here's the patch you can
apply for LIMIT 1
> ussue. I am looking forward your opinion on it.
>

well, now I observed that problem arises when
Connection::querySingleString() 
function is called from within kexidb ( that is,  not by
some driver code ).

Take for example, the function,
 Connection::loadDataBlock()

Functions like above, which mostly query the system tables
created by kexi, 
use querySingleString() function too !! And they use it
without changing the 
default value of the  flag  -- addLimitTo1. :(. So they are
sent with 
the "LIMIT 1".

As row limiting is implemented differently in different
databases, ( not sure 
whether adherence to SQL:2003 window functions would help
?), do you think it 
would be better if the responsibility of adding the
"LIMIT" clause ( whatever 
it may be ) to the drivers ?

From what this link shows , 
http://en.wikipe
dia.org/wiki/Select_(SQL)#Non-standard_syntax
most databases "append" their respective LIMIT
clause.

(Though I'd have to parse, extract and insert it after
SELECT for sybase :P )

Cheers!
 Sharan Rao
_______________________________________________
Kexi mailing list
Kexikde.org
https://ma
il.kde.org/mailman/listinfo/kexi
Re: LIMIT 1 in Select Clause
user name
2007-12-12 16:26:33
On Tuesday 04 Dec 2007 7:17:42 pm Jarosław Staniek wrote:
> Sharan Rao said the following, On 2007-12-01 21:17:
> >  I was facing problems with the function
Connection::querySingleString()
> > in Sybase, as the " LIMIT " clause is
not supported.
>

Hmm, new thing I noticed in the Limit 1 clause. ( I should
have noticed it 
before, but I tested the clause only in commandline tsql ,
and not Kexi, 
before committing :( ),

Sybase gives a warning ( in Sybase Central ) if I execute a
query of the type
 "Select Top 1 fooColumn from fooTable where
fooClause"

Warning: "The result returned is
non-deterministic"
Of course, that's because there's no specific ordering
specified. Now, 
unfortunately, this is returned as an error in freetds/dblib
!!

Now, we do have a columnNumber being passed to
Connection::querySingleString() 
as a param, but would an "Order by " clause on
that column be right in the
case if there are multiple rows ? I guess
querySingleString() is not intended 
to be used where multiple row/multiple column results are
returned  ( as 
the documentation suggests )

Any hints ?

Cheers!
 Sharan Rao







_______________________________________________
Kexi mailing list
Kexikde.org
https://ma
il.kde.org/mailman/listinfo/kexi
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )