From: <mic...@ya...> - 2004-05-30 22:52:50
|
--- Ian Bicking <ia...@co...> escreveu: > On May 29, 2004, at 10:53 PM, Michel Thadeu wrote: > > Hi againg guys! > > > > I wondered with SQLObject :) It's cool... > > I have tried out and had another 2 questions: > > > > How is the best way to use SQLObject over a html schema? I using > > webware and I think I can't pass the object throught requests, so I > > must pass the id and get from Table the row matching the id. > > > > I done something like this: > > > > Table.select(Table.q.id==someid) > > > > But is there a method like ByAlternateID? or is a easier way to do? > The > > list index is a choice: Table.select()[someid]? > > If you are using the Subversion (0.6) version, it's > Table.get(someid), > or in 0.5.x it's Table(someid). Ah, thanks! > > Another question is in a join: > > > > I have 2 tables: > > > > class City: > > name=StringCol(length=100) > > state=ForeignKey('State') > > > > class State: > > name=StringCol(length=100) > > cities=MultipleJoin('City') > > > > I want to do something like: > > > > select city.name from city inner join state on > city.state_id=state.id > > where city.name like '%somename%' and state.id=1; > > > > I try: > > > > [i for i in City.select((City.q.name.contains('something')) & > > (State.q.id=1))] > > > > with no sucess... > > City.select(City.q.name.contains('something') & (City.q.stateID==1)). > > Ian Sparks posted about a similar but slightly more complicated join > just a couple days ago, and there's another example in that thread. Ok, I'll check! I solved like this: City.select('''name ilike '%something%' and state_id=1''') thanks for the help! I have just another question, i using SQLObject 0.5, is there a repository with 0.6 (with my ppp connect will be very hard to update debian and install a subversion client)? Thanks for all help Ian! > -- > Ian Bicking | ia...@co... | http://blog.ianbicking.org > ===== -- Michel Thadeu Sabchuk Curitiba/PR ______________________________________________________________________ Participe da pesquisa global sobre o Yahoo! Mail: http://br.surveys.yahoo.com/global_mail_survey_br |