コード例 #1
0
  def insert_interval_row(base, highestInterval):
    validAfter = base
    spoilsOn = validAfter + lifetime

    sql = "INSERT INTO acoin_interval (interval_id, valid_after, spoils_on) VALUES (%s, %s, %s)"
    inj = (highestInterval, DBUtil.int_to_ctime(validAfter), DBUtil.int_to_ctime(spoilsOn))
    cur.execute(sql, inj)
    
    return validAfter, spoilsOn
コード例 #2
0
    def insert_interval_row(base, highestInterval):
        validAfter = base
        spoilsOn = validAfter + lifetime

        sql = "INSERT INTO acoin_interval (interval_id, valid_after, spoils_on) VALUES (%s, %s, %s)"
        inj = (highestInterval, DBUtil.int_to_ctime(validAfter),
               DBUtil.int_to_ctime(spoilsOn))
        cur.execute(sql, inj)

        return validAfter, spoilsOn
コード例 #3
0
    curInterval, curTime = tup[0]
    print("You deleted ALL intervals after %s (expires at %s).  Are you SURE you wanted to do that?  (type anything except continue to abort):  " % (nextInterval, nextTime.ctime()))
    x = raw_input()
    if x != "continue":
      raise Exception("User aborted.")
  assert tup
  assert len(tup) == 1
    
  highestACoinInterval, highestACoinFreshUntil = tup[0]
  #the freshness is a ctime type... we need to convert it into a float
  base = DBUtil.ctime_to_int(highestACoinFreshUntil.ctime())
  highestACoinInterval = int(highestACoinInterval)

  sql = []
  inj = []
  startTime = highestACoinFreshUntil.ctime()
  startInterval = highestACoinInterval
  print("Creating intervals...")
  for x in range(numberOfIntervalsToMake):
    highestACoinInterval += 1
    validAfter, spoilsOn = insert_interval_row(base, highestACoinInterval)
    #need to update base for next iteration
    base = spoilsOn
    
  print("Created %s interval[s] from time %s to time %s ending with interval: %s"%(highestACoinInterval - 1 - startInterval, startTime, DBUtil.int_to_ctime(spoilsOn), highestACoinInterval - 1))
  conn.commit()
except:
  traceback.print_exception(*sys.exc_info())
finally:
  conn.release()
コード例 #4
0
ファイル: ServerStats.py プロジェクト: wallydz/BitBlinder
 def _get_db_end_time(self):
     return DBUtil.int_to_ctime(self.endTime)
コード例 #5
0
ファイル: ServerStats.py プロジェクト: wallydz/BitBlinder
 def _get_db_start_time(self):
     return DBUtil.int_to_ctime(self.startTime)
コード例 #6
0
ファイル: ServerStats.py プロジェクト: clawplach/BitBlinder
 def _get_db_end_time(self):
   return DBUtil.int_to_ctime(self.endTime)
コード例 #7
0
ファイル: ServerStats.py プロジェクト: clawplach/BitBlinder
 def _get_db_start_time(self):
   return DBUtil.int_to_ctime(self.startTime)
コード例 #8
0
        if x != "continue":
            raise Exception("User aborted.")
    assert tup
    assert len(tup) == 1

    highestACoinInterval, highestACoinFreshUntil = tup[0]
    #the freshness is a ctime type... we need to convert it into a float
    base = DBUtil.ctime_to_int(highestACoinFreshUntil.ctime())
    highestACoinInterval = int(highestACoinInterval)

    sql = []
    inj = []
    startTime = highestACoinFreshUntil.ctime()
    startInterval = highestACoinInterval
    print("Creating intervals...")
    for x in range(numberOfIntervalsToMake):
        highestACoinInterval += 1
        validAfter, spoilsOn = insert_interval_row(base, highestACoinInterval)
        #need to update base for next iteration
        base = spoilsOn

    print(
        "Created %s interval[s] from time %s to time %s ending with interval: %s"
        % (highestACoinInterval - 1 - startInterval, startTime,
           DBUtil.int_to_ctime(spoilsOn), highestACoinInterval - 1))
    conn.commit()
except:
    traceback.print_exception(*sys.exc_info())
finally:
    conn.release()