CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
idDealer.idDealer Class Reference
Inheritance diagram for idDealer.idDealer:

Public Member Functions

def __init__ (self, schema)
 
def generateNextIDForTable (self, tableName)
 
def getIDColumnDefinition (self)
 
def getIDforTable (self, tableName)
 

Private Attributes

 __idTableColumnName
 
 __idTableColumnType
 
 __schema
 

Detailed Description

Manages the autoincremental ID values.\n
Input: coral.schema object

Definition at line 3 of file idDealer.py.

Constructor & Destructor Documentation

def idDealer.idDealer.__init__ (   self,
  schema 
)

Definition at line 7 of file idDealer.py.

7  def __init__( self , schema ):
8  self.__schema = schema
11 
def __init__(self, schema)
Definition: idDealer.py:7
def idTableColumnDefinition()
Definition: nameDealer.py:97

Member Function Documentation

def idDealer.idDealer.generateNextIDForTable (   self,
  tableName 
)
Set the nextID in the IDTableName to current id value + 1 .\n
Input: ID table name.

Definition at line 33 of file idDealer.py.

References idDealer.idDealer.__idTableColumnName, data, nameDealer.idTableName(), GetRecoTauVFromDQM_MC_cff.next, and harvestTrackValidationPlots.str.

33  def generateNextIDForTable( self, tableName ):
34  """
35  Set the nextID in the IDTableName to current id value + 1 .\n
36  Input: ID table name.
37  """
38  try:
39  idtableName = nameDealer.idTableName(tableName)
40  tableHandle = self.__schema.tableHandle(idtableName)
41  query = tableHandle.newQuery()
42  query.addToOutputList(self.__idTableColumnName)
43  query.setForUpdate() #lock it
44  cursor = query.execute()
45  result = 0
46  while ( next(cursor) ):
47  result = cursor.currentRow()[0].data()
48  dataEditor = tableHandle.dataEditor()
49  inputData = coral.AttributeList()
50  dataEditor.updateRows('NEXTID = NEXTID+1','',inputData)
51  del query
52  return result+1
53  except Exception as e:
54  raise Exception(str(e))
55 
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def idTableName(dataTableName)
Definition: nameDealer.py:94
def generateNextIDForTable(self, tableName)
Definition: idDealer.py:33
def idDealer.idDealer.getIDColumnDefinition (   self)

Definition at line 12 of file idDealer.py.

References idDealer.idDealer.__idTableColumnName, and idDealer.idDealer.__idTableColumnType.

12  def getIDColumnDefinition( self ):
13  return (self.__idTableColumnName, self.__idTableColumnType)
14 
def getIDColumnDefinition(self)
Definition: idDealer.py:12
def idDealer.idDealer.getIDforTable (   self,
  tableName 
)
get the new id value to use for the given table

Definition at line 15 of file idDealer.py.

References idDealer.idDealer.__idTableColumnName, data, nameDealer.idTableName(), GetRecoTauVFromDQM_MC_cff.next, and harvestTrackValidationPlots.str.

15  def getIDforTable( self, tableName ):
16  """
17  get the new id value to use for the given table
18  """
19  try:
20  idtableName = nameDealer.idTableName(tableName)
21  query = self.__schema.tableHandle(idtableName).newQuery()
22  query.addToOutputList(self.__idTableColumnName)
23  query.setForUpdate() #lock it
24  cursor = query.execute()
25  result = 0
26  while ( next(cursor) ):
27  result = cursor.currentRow()[self.__idTableColumnName].data()
28  del query
29  return result
30  except Exception as e:
31  raise Exception(str(e))
32 
def getIDforTable(self, tableName)
Definition: idDealer.py:15
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def idTableName(dataTableName)
Definition: nameDealer.py:94

Member Data Documentation

idDealer.idDealer.__idTableColumnName
private
idDealer.idDealer.__idTableColumnType
private

Definition at line 10 of file idDealer.py.

Referenced by idDealer.idDealer.getIDColumnDefinition().

idDealer.idDealer.__schema
private

Definition at line 8 of file idDealer.py.