def peekID ( self ):
    """Look at the next ID but don't claim it.  This is an internal interface.
        It is not thread safe.  Need a way to lock the ids table for the 
        transaction to make it safe."""
    
    with closing(self.conn.cursor()) as cursor:

      # Query the current max identifier
      sql = "SELECT max(id) FROM " % str ( self.proj.getIdsTable() )
      try:
        cursor.execute ( sql )
      except MySQLdb.Error, e:
        logger.warning ("Problem retrieving identifier {}: {}. sql={}".format(e.args[0], e.args[1], sql))
        raise

      # Here we've queried the highest id successfully    
      row = cursor.fetchone()
      # if the table is empty start at 1, 0 is no annotation
      if ( row[0] == None ):
        identifier = 1
      else:
        identifier = int ( row[0] ) + 1

      return identifier
dataset/ETHPy150Open neurodata/ndstore/ocpca/ocpcadb.py/OCPCADB.peekID/operator `+` -> `%`