/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
DybPython::dbs::DBS Class Reference

List of all members.

Public Member Functions

def __init__
def cfvld
def cfpay
def cftab
def tables_in_common
def ctxs_in_common

Detailed Description

Definition at line 5 of file dbs.py.


Constructor & Destructor Documentation

def DybPython::dbs::DBS::__init__ (   self,
  dbconfs 
)

Definition at line 6 of file dbs.py.

00007                                 :
00008         self[:] = map(DB,dbconfs)    


Member Function Documentation

def DybPython::dbs::DBS::cfvld (   self,
  tab 
)
Entry by entry vld comparison 

Definition at line 9 of file dbs.py.

00010                            :
00011         """
00012         Entry by entry vld comparison 
00013         """
00014         assert len(self) == 2
00015         adb,bdb = self
00016         q = "select * from %(tab)sVld order by SEQNO asc" % locals()
00017         mm = []
00018         for a,b in zip(adb(q),bdb(q)):
00019             sq, ts = a['SEQNO'], str(a['TIMESTART'])
00020             if a['INSERTDATE'] == b['INSERTDATE']: 
00021                 log.warn("INSERTDATEs are same %s %s possibly and invalid comparison with self " % ( a, b ))
00022             if dict(a,INSERTDATE="*") == dict(b,INSERTDATE="*"):
00023                 pass
00024             else:
00025                 mm.append( dict(msg="cfvld mismatch", tab=tab, sq=sq, a=a, b=b ))
00026         return mm

def DybPython::dbs::DBS::cfpay (   self,
  tab,
  firstmismatch = True 
)
Entry by entry payload comparison 

Definition at line 27 of file dbs.py.

00028                                                :
00029         """
00030         Entry by entry payload comparison 
00031         """
00032         assert len(self) == 2
00033         adb,bdb = self
00034         q = "select * from %(tab)s order by SEQNO asc, ROW_COUNTER asc" % locals()
00035         mm = []
00036         for a,b in zip(adb(q),bdb(q)):
00037             sq, rc = int(a['SEQNO']), int(a['ROW_COUNTER'])
00038             if a == b:
00039                 pass
00040             else:
00041                 mm.append( dict(msg="cfpay mismatch", tab=tab, sq=sq, rc=rc, a=a,b=b ) )
00042                 if firstmismatch:
00043                     break     ## too many payload mismatches 
00044         return mm

def DybPython::dbs::DBS::cftab (   self,
  tab 
)
Entry by entry comparisons of a table between 2 databases, until hit differneces

Definition at line 45 of file dbs.py.

00046                           :
00047         """ 
00048         Entry by entry comparisons of a table between 2 databases, until hit differneces
00049         """
00050         mmv = self.cfvld( tab )
00051         mmp = self.cfpay( tab )
00052         return mmv + mmp
00053 

def DybPython::dbs::DBS::tables_in_common (   self,
  tab = None 
)
Hmm maybe return `Tab` instances instead of names 

Definition at line 54 of file dbs.py.

00055                                           :
00056         """
00057         Hmm maybe return `Tab` instances instead of names 
00058         """
00059         if tab:
00060             tns = [tab]
00061         else:
00062             tns = set()        ## collect tables in common to all DB
00063             for db in self:    
00064                 if len(tns) == 0:
00065                     tns.update(db.showpaytables)
00066                 else:
00067                     tns.intersection_update(db.showpaytables)  
00068                 pass
00069             log.debug( "tables_in_common tns %s " % tns ) 
00070         return tns

def DybPython::dbs::DBS::ctxs_in_common (   self,
  tn,
  ctx = None 
)

Definition at line 71 of file dbs.py.

00072                                              :
00073         if ctx:
00074             ctxs = [ctx]
00075         else:  
00076             ctxs = set()     ## collect contexts in common to the same tables 
00077             tas = map(lambda db:db.tab(tn),self) 
00078             for ta in tas:   ## same table in each db 
00079                 actxs = ta.actual_ctxs() 
00080                 if len(ctxs) == 0:
00081                     ctxs.update(actxs)
00082                 else:
00083                     ctxs.intersection_update(actxs)
00084                 pass 
00085                 log.debug("table %s common ctx %s " % ( tn, ctxs)) 
00086             pass
00087         return sorted(ctxs,cmp=lambda a,b:cmp(str(a),str(b)))
00088 


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:55:40 for DybPython by doxygen 1.7.4