In my last post I said r2=f1(db.Section.schoolYear==2009).select() -
works fine.
But I'm still struggling with SQLSets. I've read through the web2py
book and looked at examples online. Unfortunately I can't find
examples that clarify complex SQLSet syntax. I don't know how best to
present all the scenarios I've tried so I'll just list a few below.
Example 1: Trying to filter a SQLSet (f1) using multiple conditions:
r2=f1(db.Section.schoolYear==2009 and db.Section.id==7540).select()
- results in:
"ProgrammingError: The cursor's connection has been closed."
Example 2: Tried to create a subset of the original set:
>>>subset2=db(f1)(db.Section.id==7540)
>>> r6=subset2.select()
Traceback (most recent call last):
File "C:\web2py\applications\ajaxShell/controllers/default.py", line
88, in talk
exec(request.vars.s) in {},d
File "<string>", line 1, in <module>
File "C:\web2py\gluon\sql.py", line 2210, in select
query = self._select(*fields, **attributes)
File "C:\web2py\gluon\sql.py", line 2117, in _select
fields = [self._db[table].ALL for table in self._tables]
File "C:\web2py\gluon\sql.py", line 524, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'gluon'
Example 3: Tried to select specific fields from the original SQLSet:
>>>r3=f1(db.Section.id==7540).select(db.Employee.name,db.Section.name,db.Cell.row,db.Cell.col,db.Cell.block,db.Period.periodStart,db.Period.periodEnd)
"ProgrammingError: The cursor's connection has been closed."
Example 4: Tried to create a subset from a new. more complex set:
>>>set=db((db.Employee.id==db.EmployeeSection.employeeID) & \
(db.Section.id==db.EmployeeSection.sectionID) & \
(db.Employee.id==9000) & \
(db.Cell.id==db.SectionCell.cellID) & \
(db.Section.id==db.SectionCell.sectionID) & \
(db.Period.id==db.SectionCell.periodID))
>>> subset=set(db.Section.id==7540)
>>> subset.select() results in:
"ProgrammingError: The cursor's connection has been closed."
Thanks in advance for your help.
-Michael
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---