I have two problems; 1. When I successfully submit a form and try to retrieve the text for processing in the controller, I tend to get the previously submitted text and not the latest. I tried to get the latest database insert based on the current time using this code but get the operational error. I want to check the current time in order to retrieve the latest inserted text.
controller code: def retrieve(): dt=request.now row = db(db.post.author== auth.user.id).select(db.post.ALL, orderby=~db. post.created_on == dt, limitby=(0,1)).first() message = row.message if row else None return dict(message=message, form=form) Error message row = db(db.post.author== auth.user.id).select(db.post.ALL, orderby=~db. post.created_on == dt, limitby=(0,1)).first() File "/usr/local/lib/python2.7/dist-packages/pydal/objects.py", line 2250, in select return adapter.select(self.query, fields, attributes) File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/sqlite.py", line 82, in select return super(SQLite, self).select(query, fields, attributes) File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/base.py", line 762, in select return self._select_aux(sql, fields, attributes, colnames) File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/base.py", line 718, in _select_aux rows = self._select_aux_execute(sql) File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/base.py", line 712, in _select_aux_execute self.execute(sql) File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/__init__.py", line 67, in wrap return f(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/pydal/adapters/base.py", line 412, in execute rv = self.cursor.execute(command, *args[1:], **kwargs) OperationalError: near "DESC": syntax error Problem/query: Is there a way to have a trigger in the db, that when there is an insert, the db updates to the controller the current text? something like: CREATE TRIGGER your_table_trig AFTER UPDATE ON your_table BEGIN update your_table SET updated_on = datetime('now') WHERE user_id = NEW.user_id; END; -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.