Re: [SQLObject] Query using ends with

2008-10-04 Thread Oleg Broytmann
On Wed, Oct 01, 2008 at 04:27:41PM -0300, Leandro Sales wrote: > > from sqlobject.sqlbuilder import SQLConstant > it worked, but just as following: > > from sqlobject.sqlbuilder import SQLConstant > domain = > Domain.select(SQLConstant("'www.domain1.com'").endswith(Domain.q.name)) > > Note th

Re: [SQLObject] Query using ends with

2008-10-04 Thread Leandro Sales
I'd like a sqlobject query that does: Domain table: id name 1domain1.com 2domain2.com 3domain3.com hostname = 'www.domain1.com' SELECT * FROM domain WHERE hostname LIKE CONCAT('%', name); or in a similar way: SELECT * FROM domain WHERE LOCATE(name, hostname); The

Re: [SQLObject] Query using ends with

2008-10-04 Thread Leandro Sales
On Wed, Oct 1, 2008 at 4:11 PM, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Wed, Oct 01, 2008 at 03:41:09PM -0300, Leandro Sales wrote: >> qname = "www.domain1.com" >> domain = Domain.select("""'""" + qname + """' LIKE CONCAT('%', >> domain.name)""") > > from sqlobject.sqlbuilder import SQLCons

[SQLObject] Query using ends with

2008-10-04 Thread Leandro Sales
Hello. Please consider the following: I have a sqlobject object named Domain that stores the list of available domains: class Domain(SQLObject): name = StringCol(alternateID=True, length=255, default=None) In the database I have domains like: IDname -- 1 domai

Re: [SQLObject] Query using ends with

2008-10-01 Thread Oleg Broytmann
On Wed, Oct 01, 2008 at 03:41:09PM -0300, Leandro Sales wrote: > qname = "www.domain1.com" > domain = Domain.select("""'""" + qname + """' LIKE CONCAT('%', > domain.name)""") from sqlobject.sqlbuilder import SQLConstant domain = Domain.select(SQLConstant('www.domain1.com').endswith(Domain.q.name)

Re: [SQLObject] Query using ends with

2008-10-01 Thread Leandro Sales
On Wed, Oct 1, 2008 at 3:29 PM, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Wed, Oct 01, 2008 at 03:19:14PM -0300, Leandro Sales wrote: >> SELECT * FROM domain WHERE LOCATE(name, hostname); > > Try: > > from sqlobject.sqlbuilder import func > Domain.select(func.LOCATE(Domain.q.name, hostname))

Re: [SQLObject] Query using ends with

2008-10-01 Thread Oleg Broytmann
On Wed, Oct 01, 2008 at 03:19:14PM -0300, Leandro Sales wrote: > SELECT * FROM domain WHERE LOCATE(name, hostname); Try: from sqlobject.sqlbuilder import func Domain.select(func.LOCATE(Domain.q.name, hostname)) Oleg. -- Oleg Broytmannhttp://phd.pp.ru/[EMAIL PROTE

Re: [SQLObject] Query using ends with

2008-10-01 Thread Leandro Sales
On Wed, Oct 1, 2008 at 3:19 PM, Leandro Sales <[EMAIL PROTECTED]> wrote: > I'd like a sqlobject query that does: > > Domain table: > id name > 1domain1.com > 2domain2.com > 3domain3.com > > hostname = 'www.domain1.com' > > SELECT * FROM domain WHERE hostname LIKE CONCA

Re: [SQLObject] Query using ends with

2008-10-01 Thread Oleg Broytmann
On Wed, Oct 01, 2008 at 02:34:16PM -0300, Leandro Sales wrote: > On Tue, Sep 30, 2008 at 7:19 PM, Leandro Sales <[EMAIL PROTECTED]> wrote: > > but instead, I'd check which domain name is in the hostname. Somethink like: > > > > domain = Domain.select("www.domain1.com".endswith(Domain.q.name.endswit

Re: [SQLObject] Query using ends with

2008-10-01 Thread Leandro Sales
On Tue, Sep 30, 2008 at 7:19 PM, Leandro Sales <[EMAIL PROTECTED]> wrote: > > Hello. Please consider the following: I have a sqlobject object named > Domain that stores the list of available domains: > > class Domain(SQLObject): >name = StringCol(alternateID=True, length=255, default=None) > >