On Apr 6, 2:19 am, cyber <[email protected]> wrote:
> Denes, you opened my eyes to me again.
> ***************************************************
> I tried to use %%s%% and there was an error message.
> So, the only one character % separated me from the correct result!
>
> And say what way is more preferable to use: db.select() or
> db.executesql() ?

In general db(...).select() is the way to go since it is independent
of the DB.
BTW, you are welcome ;)

>
> By the way, thank you very much!
> ***************************************************
>
> On 5 апр, 23:48, DenesL <[email protected]> wrote:
>
>
>
>
>
>
>
> > ... or the equivalent raw sql
>
> > results=db.executesql("SELECT * FROM autos WHERE num LIKE %%%s%%;"
> > %n)
>
> > On Apr 5, 4:45 pm, DenesL <[email protected]> wrote:
>
> > > I believe you want
>
> > > results=db(db.autos.num.contains(n)).select()
>
> > > On Apr 5, 3:58 pm, cyber <[email protected]> wrote:
>
> > > > I need a hint!
>
> > > > It seems that LIKE operator doesn't work.Or... I'm not so clever
> > > > human...
>
> > > > Say, how can I deal with rawsql query? I need to find all records but
> > > > I know only some part of exact value. The code:
>
> > > > n=request.vars.num  ### it returns only number
> > > > results=db.executesql("SELECT * FROM autos WHERE num LIKE %s;" %(n))
> > > > ### select
> > > > return dict(results=results) ### it returns rows with exact n values
> > > > only
>
> > > > ... how can I find all records (not only n) including missed nums and
> > > > chars?

Reply via email to