why not simply?
db.commit()
db.close()
if db in an on object attribute like self.db you can do
if self.db:
self.db.commit()
self.db.close()
self.db = 0
you can also do:
BaseAdapter.close_all_instances('commit')
On Friday, 22 June 2012 11:23:47 UTC-5, demetrio wrote:
>
>
> Hi everyone,
>
> I have connected WebDAV and SVN auth with a wsgi script. I needed to use a
> standalone DAL. When you do a dav petition with the navigator it makes a
> lot of petitions. Well, the thing is that always there is a connection
> opened (i can see them with PhpMyAdmin)
>
> if self.db:
> self.db._adapter.close()
>
> seeing this issue:
> http://code.google.com/p/web2py/issues/detail?id=731<http://code.google.com/p/web2py/issues/detail?id=731#c4>
>
> I have tried a lot of the lines that i found there
>
> something like:
>
> if self.db:
> from gluon.dal import BaseAdapter
> BaseAdapter.close_all_instances(None)
> BaseAdapter.close_all_instances('commit')
> BaseAdapter.close_all_instances('rollback')
>
> something like:
> if self.db:
> from gluon.dal import thread as dal_thread
> dal_thread.instances.remove(self.db._adapter)
> self.db._adapter.close()
>
> and even something desesperated like:
> if self.db:
> from gluon.dal import thread as dal_thread
> dal_thread.instances.remove(self.db._adapter)
> self.db._adapter.close()
> self.db._adapter.close_all_instances(None)
> self.db._adapter.close_all_instances('commit')
> self.db._adapter.close_all_instances('rollback')
>
> from gluon.dal import ConnectionPool
> ConnectionPool.close_all_instances(None)
> ConnectionPool.close_all_instances('commit')
> ConnectionPool.close_all_instances('rollback')
>
> from gluon.dal import BaseAdapter
> BaseAdapter.close_all_instances(None)
> BaseAdapter.close_all_instances('commit')
> BaseAdapter.close_all_instances('rollback')
>
> But always, in the best, it leaves at least one connection opened, and i
> don't know how to deal with it.
>
> I have using web2py 1.99.7 in both development and production environments.
>
> Any ideas? in this moment we are building a python mysql script, but we
> want to use DAL to make it runnable on any of the web2py/DAL supported db
>
> Thanks in advance
>