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 5 of file idDealer.py.

Constructor & Destructor Documentation

def idDealer.idDealer.__init__ (   self,
  schema 
)

Definition at line 9 of file idDealer.py.

9  def __init__( self , schema ):
10  self.__schema = schema
13 
def __init__(self, schema)
Definition: idDealer.py:9
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 35 of file idDealer.py.

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

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

Definition at line 14 of file idDealer.py.

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

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

Definition at line 17 of file idDealer.py.

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

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

Member Data Documentation

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

Definition at line 12 of file idDealer.py.

Referenced by idDealer.idDealer.getIDColumnDefinition().

idDealer.idDealer.__schema
private

Definition at line 10 of file idDealer.py.