Ejemplo n.º 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)
Ejemplo n.º 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))
Ejemplo n.º 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)
Ejemplo n.º 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))