I was trying to show that Sessions does not actually use the query
interface (db(
table.id==record_id).select()) in really only uses
get,set,del.
> > del db.sessions[0] -> clear table
>
> not explicit so dangerous, imagine del db.sessions[id] and id==0 by
> mistake? do you really want to clear the table?
Very true, this should not be exposed to the user. But if you think
about it the other way,
the lower level driver could implement:
del db.sessions[0]
the high level dal api would call this:
db.sessions.clear() -> del db.sessions[0]
> > del db.sessions[id] -> drop row
>
> works, in trunk
>
> > db.sessions[0] = db.sessions(**attrs) -> insert
the high level dal api would call this:
db.sessions.insert(**attrs)
the lower level driver could implement:
->rec = db.sessions[0] = db.sessions(**attrs)
->if rec and getattr(rec,'id',None):
-> return 1
->return 0
the low level table drivers (the plumbing) could expose the set:
__call__,__getitem__,__setitem__,__delitem__
the high level dal api (the porcelain) could expose the set:
insert(),clear(),...
This way you can add to the high level api without touching every
driver, since the high level api could call the low level driver the
implement the command.
Also, one could create DICTDB which is sufficient to handle sessions
and simple CRUD for tables (insert,fetch,update,delete,all), web2py
could work (sessions and CRUD) out of the box w/o having to install
sqlite, so new users do not need to install sqlite to try a sample
welcome application scaffolding. ;)
Robin