He is using DAL query

Here is a copy of the original post. His question is the very last sentence
=/


I have defined two tables:


db.define_table('doelgroep',
   db.Field
('doelgroep',length=24,default='',notnull=True,unique=True),
    migrate=False)


db.define_table('event',
   db.Field
('bedrijf',db.bedrijf,default='',notnull=True,ondelete='CASCADE'),
    ...
   db.Field('doelgroep',db.doelgroep,ondelete='RESTRICT'),
   ...
   migrate=False)


I a function I have the following lines of code:

def index():
   ...
   events=db((db.event.bedrijf==1)&(db.event.van_datum>=request.now)&
\
   (db.event.doelgroep==1)&(db.event.scope==2))\
   .select
(db.event.id,db.event.event,db.event.event_zin,db.event.van_datum,\
    orderby=db.event.van_datum,limitby=(0,1))
   ...
   return dict(events=events)


executing this code results in a error tickets which reads like:

ProgrammingError: operator does not exist: character varying = integer
LINE 1: ...event.van_datum>='2009-10-21') AND event.doelgroep=1) AND
ev...
                                                            ^
HINT:  No operator matches the given name and argument type(s). You
might need to add explicit type casts.


Where the ^ points to the  = sign in doelgroep=1


How do I solve this problem. Why doesn't 'db.event.bedrijf==1' result
in an error, to me both expressions are the same.


Kind regards,



-Thadeus




On Wed, Oct 21, 2009 at 12:56 PM, mdipierro <[email protected]> wrote:

>
> it is not clear what the context is. I think that is SQL not DAL
> therefore it is correct.
>
> where is the original question?
>
> massimo
>
> On Oct 21, 12:36 pm, Thadeus Burgess <[email protected]> wrote:
> > LINE 1: ...event.van_datum>='2009-10-21') AND event.doelgroep=1)
> >
> > You have an assignment operator, not the equals operator.
> >
> > LINE 1: ...event.van_datum>='2009-10- 21') AND event.doelgroep==1)
> >
> > -Thadeus
> >
> > On Wed, Oct 21, 2009 at 11:37 AM, mdipierro <[email protected]>
> wrote:
> >
> > > I miss some context here (where is the original post?). Anyway I do
> > > not think that is the problem.
> >
> > > On Oct 21, 10:38 am, Yarko Tymciurak <[email protected]>
> > > wrote:
> > > > On Wed, Oct 21, 2009 at 3:51 AM, annet <[email protected]>
> wrote:
> >
> > > > ......
> >
> > > > > executing this code results in a error tickets which reads like:
> >
> > > > > ProgrammingError: operator does not exist: character varying =
> integer
> > > > > LINE 1: ...event.van_datum>='2009-10-21') AND event.doelgroep=1)
> AND
> > > > > ev...
> >
> > > >                                                             ^
> >
> > > > It reads to me like this may be complaining about the  phrase:
> > > > event.van_datum>='2009-10-21'
> >
> > > > which looks like an integer compare ( ">=" )  against a string  (
> > > > "2009-10-21" )
> >
> > > > I would guess your problem lies there...
> >
> > > > > HINT:  No operator matches the given name and argument type(s). You
> > > > > might need to add explicit type casts.
> >
> > > > > Where the ^ points to the  = sign in doelgroep=1
> >
> > > > > How do I solve this problem. Why doesn't 'db.event.bedrijf==1'
> result
> > > > > in an error, to me both expressions are the same.
> >
> > > > > Kind regards,
> >
> > > > > Annet
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to