← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 781297] Re: sql_db missing "temporary" cursors

 

** Changed in: openobject-server
       Status: New => Confirmed

** Changed in: openobject-server
     Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/781297

Title:
  sql_db missing "temporary" cursors

Status in OpenERP Server:
  Confirmed

Bug description:
  In sql_db.py, each time we ask for a connection to a database (dsn, to be more exact), the ConnectionPool there picks one of the available ones or creates a new. When we are finished (ie. close and free the cursor), it puts the connection back into the pool (but keeps it open).
  This means that we _cannot_ have a method to poll a db (ie. connect, query, disconnect). This is needed in some cases, where we need to see if a db is valid to use. Example, in ftp/webdav or other "service" addons, we list the dbs and then look inside them for the appropriate settings, to see if we can use them.

  Results: we end up holding unnecessary connections to idle dbs, or
  even block buildbot from dropping them.

  Recommended solution: write a method in sql_db.py, which will fetch a
  cursor with "temporary" behavior. If the cursor had come from the pool
  (ie. was open before), it will go back there. If not, it will freed
  and the connection closed. This will be an API enhancement, backwards
  compatible.


References