dbapi.py
changeset 9046 6fb3f0106301
parent 9045 5378a738f333
child 9067 262d7874c6c7
equal deleted inserted replaced
9045:5378a738f333 9046:6fb3f0106301
    35 
    35 
    36 from logilab.common.logging_ext import set_log_methods
    36 from logilab.common.logging_ext import set_log_methods
    37 from logilab.common.decorators import monkeypatch, cachedproperty
    37 from logilab.common.decorators import monkeypatch, cachedproperty
    38 from logilab.common.deprecation import deprecated
    38 from logilab.common.deprecation import deprecated
    39 
    39 
    40 from cubicweb import ETYPE_NAME_MAP, AuthenticationError,\
    40 from cubicweb import (ETYPE_NAME_MAP, AuthenticationError, ProgrammingError,
    41      cwvreg, cwconfig
    41                       cwvreg, cwconfig)
    42 from cubicweb.repoapi import get_repository
    42 from cubicweb.repoapi import get_repository
    43 from cubicweb.req import RequestSessionBase
    43 from cubicweb.req import RequestSessionBase
    44 
    44 
    45 
    45 
    46 _MARKER = object()
    46 _MARKER = object()
   389     info = warning = error = critical = exception = debug = lambda msg,*a,**kw: None
   389     info = warning = error = critical = exception = debug = lambda msg,*a,**kw: None
   390 
   390 
   391 set_log_methods(DBAPIRequest, getLogger('cubicweb.dbapi'))
   391 set_log_methods(DBAPIRequest, getLogger('cubicweb.dbapi'))
   392 
   392 
   393 
   393 
   394 # exceptions ##################################################################
       
   395 
       
   396 class ProgrammingError(Exception): #DatabaseError):
       
   397     """Exception raised for errors that are related to the database's operation
       
   398     and not necessarily under the control of the programmer, e.g. an unexpected
       
   399     disconnect occurs, the data source name is not found, a transaction could
       
   400     not be processed, a memory allocation error occurred during processing,
       
   401     etc.
       
   402     """
       
   403 
       
   404 
   394 
   405 # cursor / connection objects ##################################################
   395 # cursor / connection objects ##################################################
   406 
   396 
   407 class Cursor(object):
   397 class Cursor(object):
   408     """These objects represent a database cursor, which is used to manage the
   398     """These objects represent a database cursor, which is used to manage the