/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes | Private Member Functions
DybDbi::rollback::Rollback Class Reference

List of all members.

Public Member Functions

def __init__
def __repr__
def config
def __enter__
def __exit__

Public Attributes

 global_
 bytable

Private Member Functions

def _config

Detailed Description

INSERTDATE rollback context manager

Definition at line 16 of file rollback.py.


Constructor & Destructor Documentation

def DybDbi::rollback::Rollback::__init__ (   self,
  global_ = None,
  bytable 
)
:param global_: datetime or TimeStamp instance for global rollback
:param bytable: DBI table names keys (eg CableMap) providing rollback datetime or TimeStamp instances for per-table rollbacks

Definition at line 20 of file rollback.py.

00021                                                 :
00022         """
00023         :param global_: datetime or TimeStamp instance for global rollback
00024         :param bytable: DBI table names keys (eg CableMap) providing rollback datetime or TimeStamp instances for per-table rollbacks
00025         """  
00026         self.global_ = global_
00027         self.bytable = bytable


Member Function Documentation

def DybDbi::rollback::Rollback::__repr__ (   self)

Definition at line 28 of file rollback.py.

00029                       :
00030         return "%s global %s by DBI table %s " % ( self.__class__.__name__, self.global_ , repr(self.bytable) )

def DybDbi::rollback::Rollback::_config (   self,
  n,
  t,
  delta_seconds = 1 
) [private]
:param n: ``*`` or DBI table name 
:param t:  ``TimeStamp`` or ``datetime`` instance
:param delta_seconds:  as rollback uses ``INSERTDATE < t``  (less than rather than less than or equal to) 
               the default is to add one second to requested the ROLLBACK date, which is usually what is required

Definition at line 31 of file rollback.py.

00032                                              :
00033         """
00034         :param n: ``*`` or DBI table name 
00035         :param t:  ``TimeStamp`` or ``datetime`` instance
00036         :param delta_seconds:  as rollback uses ``INSERTDATE < t``  (less than rather than less than or equal to) 
00037                                the default is to add one second to requested the ROLLBACK date, which is usually what is required
00038         """ 
00039         if isinstance( t, datetime ):
00040             delta = timedelta( seconds=delta_seconds )   
00041             ts = TimeStamp.fromAssumedUTCDatetime( t + delta )
00042         elif isinstance( t, TimeStamp ):
00043             ts = TimeStamp(t)
00044             ts.Add(delta_seconds)
00045         else:
00046             raise Exception("Rollback.config requires a datetime or TimeStamp argument")
00047         return "%s = %s" % (n,ts.AsString("s")) 

def DybDbi::rollback::Rollback::config (   self,
  global_,
  bytable 
)
:param global_:
:param bytable: 

Definition at line 48 of file rollback.py.

00049                                           :
00050         """
00051         :param global_:
00052         :param bytable: 
00053         """
00054         rbs = lambda n,t:self._config(n,t) 
00055         ss = []
00056         if self.global_:
00057             ss.append( rbs("*",self.global_) )
00058         else:
00059             log.debug("Rollback global_ of None means no global rollback")
00060         for n,t in bytable.items():
00061             if t:
00062                 ss.append(rbs(n,t))
00063             else:
00064                 log.warn("Rollback for table %s of None means no rollback for that table" % ( n ))
00065         s = ",".join(ss)
00066         log.debug("setting rollback string to %s " % s )
00067         gDbi.ConfigRollbackDates(s)
00068 

def DybDbi::rollback::Rollback::__enter__ (   self)

Definition at line 69 of file rollback.py.

00070                        :
        self.config(self.global_, **self.bytable)
def DybDbi::rollback::Rollback::__exit__ (   self,
  type,
  value,
  tb 
)

Definition at line 71 of file rollback.py.

00072                                         :
00073         from DybDbi import gDbi
00074         gDbi.ClearRollbackDates()
00075 


Member Data Documentation

Definition at line 23 of file rollback.py.

Definition at line 23 of file rollback.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:57:24 for DybDbi by doxygen 1.7.4