I'd like a sqlobject query that does: Domain table: id name 1 domain1.com 2 domain2.com 3 domain3.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 problem in the second approach (though I think it is more efficient and the first one), is if the variable hostname is "www.domain1.com.br", the query is still valid, but it shouldn't be. So, what is the best way to do what I need? Thank you, Leandro. On Wed, Oct 1, 2008 at 2:59 PM, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > 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.endswith())) > > I don't understand what query you are going to build. Can you elaborate? > > Oleg. > -- > Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED] > Programmers don't die, they just GOSUB without RETURN. > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > sqlobject-discuss mailing list > sqlobject-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > -- Leandro Melo de Sales Pervasive and Embedded Computing Laboratory Master in Computer Science http://embedded.ufcg.edu.br/indexen.html +55 83 3310-1404 (extension 208) http://www.leandrosales.com/ PGP: 0xDE492718 @ wwwkeys.pgp.net ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss