test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
idDealer.idDealer Class Reference
Inheritance diagram for idDealer.idDealer:

Public Member Functions

def __init__
 
def generateNextIDForTable
 
def getIDColumnDefinition
 
def getIDforTable
 

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.

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(), and GetRecoTauVFromDQM_MC_cff.next.

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

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

Member Data Documentation

idDealer.idDealer.__idTableColumnName
private

Definition at line 9 of file idDealer.py.

Referenced by idDealer.idDealer.generateNextIDForTable(), idDealer.idDealer.getIDColumnDefinition(), and idDealer.idDealer.getIDforTable().

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.