Public Member Functions | |
def | __init__ |
def | generateNextIDForTable |
def | getIDColumnDefinition |
def | getIDforTable |
Private Attributes | |
__idTableColumnName | |
__idTableColumnType | |
__schema |
Manages the autoincremental ID values.\n Input: coral.schema object
Definition at line 3 of file idDealer.py.
def idDealer::idDealer::__init__ | ( | self, | |
schema | |||
) |
Definition at line 7 of file idDealer.py.
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.
00034 : 00035 """ 00036 Set the nextID in the IDTableName to current id value + 1 .\n 00037 Input: ID table name. 00038 """ 00039 try: 00040 idtableName = nameDealer.idTableName(tableName) 00041 tableHandle = self.__schema.tableHandle(idtableName) 00042 query = tableHandle.newQuery() 00043 query.addToOutputList(self.__idTableColumnName) 00044 query.setForUpdate() #lock it 00045 cursor = query.execute() 00046 result = 0 00047 while ( cursor.next() ): 00048 result = cursor.currentRow()[0].data() 00049 dataEditor = tableHandle.dataEditor() 00050 inputData = coral.AttributeList() 00051 dataEditor.updateRows('NEXTID = NEXTID+1','',inputData) 00052 del query 00053 return result+1 00054 except Exception, e: 00055 raise Exception, str(e)
def idDealer::idDealer::getIDColumnDefinition | ( | self | ) |
Definition at line 12 of file idDealer.py.
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.
00016 : 00017 """ 00018 get the new id value to use for the given table 00019 """ 00020 try: 00021 idtableName = nameDealer.idTableName(tableName) 00022 query = self.__schema.tableHandle(idtableName).newQuery() 00023 query.addToOutputList(self.__idTableColumnName) 00024 query.setForUpdate() #lock it 00025 cursor = query.execute() 00026 result = 0 00027 while ( cursor.next() ): 00028 result = cursor.currentRow()[self.__idTableColumnName].data() 00029 del query 00030 return result 00031 except Exception, e: 00032 raise Exception, str(e)
idDealer::idDealer::__idTableColumnName [private] |
Definition at line 7 of file idDealer.py.
idDealer::idDealer::__idTableColumnType [private] |
Definition at line 7 of file idDealer.py.
idDealer::idDealer::__schema [private] |
Definition at line 7 of file idDealer.py.