Seems I can work around this like that :
db(... & (db.table.field.belongs(('item', ''))).select(...)
Richard
On Fri, Apr 12, 2013 at 12:39 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:
> Hello,
>
> I fall on "(1=0)" with this query :
>
> There is these belongs :
>
> db(... & (db.tab
Hello,
I fall on "(1=0)" with this query :
There is these belongs :
db(... & (db.table.field.belongs(('item',))).select(...)
Richard
On Thu, Nov 8, 2012 at 12:29 PM, Cliff Kachinske wrote:
> I've been working around this Postgres/psycopg2 "feature" for ages.
>
> Something like this:
>
> que
I've been working around this Postgres/psycopg2 "feature" for ages.
Something like this:
query = db.sometable.somefield==somevalue
avoid = [id1, id2, id3] #could be an empty list
if len(avoid):
query &= ~(db.sometable.id.belongs(avoid))
On Tuesday, November 6, 2012 12:06:22 PM UTC-5, Niphlod
really don't know (but probably to ckeck for nulls)
the complete code is
def BELONGS(self, first, second):
if isinstance(second, str):
return '(%s IN (%s))' % (self.expand(first), second[:-1])
elif second==[] or second==():
return '(1=0)'
items = '
Done: http://code.google.com/p/web2py/issues/detail?id=1147
Is there a reason for
elif second==[] or second==()
while it could easily be
elif not second
?
This should fix it.
--
ok then post a bug so it doesn't get lost.
PS: I remember asking for the same thing and patching DAL, but it was for
empty lists indeed.
Il giorno martedì 6 novembre 2012 17:27:04 UTC+1, Marin Pranjić ha scritto:
>
> I tried this:
> db(db.auth_user.id.belongs())._select(db.auth_user.id)
>
> And i
I tried this:
db(db.auth_user.id.belongs())._select(db.auth_user.id)
And it prints:
'SELECT auth_user.id FROM auth_user WHERE (1=0);'
So, it works as expected.
My question is invalid because I have something else in code:
db.tablename.fieldname.belongs(set())
Which is not working:
'SELECT
uhm.
elif second==[] or second==():
return '(1=0)'
why this is not reached ?
what is printed when you use
db(db.tablename.fieldname.belongs([]))._select() ?
Il giorno martedì 6 novembre 2012 17:01:08 UTC+1, Marin Pranjić ha scritto:
>
> The issue is that SQLite allows to do:
> someth
8 matches
Mail list logo