示例#1
0
 def getIDforTable(self, tableName):
     """
     get the new id value to use for the given table
     """
     try:
         idtableName = nameDealer.idTableName(tableName)
         query = self.__schema.tableHandle(idtableName).newQuery()
         query.addToOutputList(self.__idTableColumnName)
         query.setForUpdate()  #lock it
         cursor = query.execute()
         result = 0
         while (next(cursor)):
             result = cursor.currentRow()[self.__idTableColumnName].data()
         del query
         return result
     except Exception, e:
         raise Exception, str(e)
示例#2
0
 def getIDforTable( self, tableName ):
     """
     get the new id value to use for the given table
     """
     try:
         idtableName = nameDealer.idTableName(tableName)
         query = self.__schema.tableHandle(idtableName).newQuery()
         query.addToOutputList(self.__idTableColumnName)
         query.setForUpdate() #lock it
         cursor = query.execute()
         result = 0
         while ( next(cursor) ):
             result = cursor.currentRow()[self.__idTableColumnName].data()
         del query
         return result
     except Exception as e:
         raise Exception(str(e))
示例#3
0
 def generateNextIDForTable(self, tableName):
     """
     Set the nextID in the IDTableName to current id value + 1 .\n
     Input: ID table name.
     """
     try:
         idtableName = nameDealer.idTableName(tableName)
         tableHandle = self.__schema.tableHandle(idtableName)
         query = tableHandle.newQuery()
         query.addToOutputList(self.__idTableColumnName)
         query.setForUpdate()  #lock it
         cursor = query.execute()
         result = 0
         while (next(cursor)):
             result = cursor.currentRow()[0].data()
         dataEditor = tableHandle.dataEditor()
         inputData = coral.AttributeList()
         dataEditor.updateRows('NEXTID = NEXTID+1', '', inputData)
         del query
         return result + 1
     except Exception, e:
         raise Exception, str(e)
示例#4
0
 def generateNextIDForTable( self, tableName ):
     """
     Set the nextID in the IDTableName to current id value + 1 .\n
     Input: ID table name.
     """
     try:
         idtableName = nameDealer.idTableName(tableName)
         tableHandle = self.__schema.tableHandle(idtableName)
         query = tableHandle.newQuery()
         query.addToOutputList(self.__idTableColumnName)
         query.setForUpdate() #lock it
         cursor = query.execute()
         result = 0
         while ( next(cursor) ):
             result = cursor.currentRow()[0].data()
         dataEditor = tableHandle.dataEditor()
         inputData = coral.AttributeList()
         dataEditor.updateRows('NEXTID = NEXTID+1','',inputData)
         del query            
         return result+1
     except Exception as e:
         raise Exception(str(e))