예제 #1
0
 def exportSetupMatrices(self, cursor):
   with transaction.atomic(using=self.database, savepoint=False):
     print("Exporting setup matrices...")
     starttime = time()
     cursor.execute("SELECT name FROM setupmatrix")
     primary_keys = set([ i[0] for i in cursor.fetchall() ])
     cursor.executemany(
       "insert into setupmatrix \
       (name,source,lastmodified) \
       values(%s,%s,%s)",
       [
         (i.name, i.source, self.timestamp)
         for i in frepple.setupmatrices()
         if i.name not in primary_keys and (not self.source or self.source == i.source)
       ])
     cursor.executemany(
       "update setupmatrix \
        set source=%s, lastmodified=%s \
        where name=%s",
       [
         (i.source, self.timestamp, i.name)
         for i in frepple.setupmatrices()
         if i.name in primary_keys and (not self.source or self.source == i.source)
       ])
     print('Exported setupmatrices in %.2f seconds' % (time() - starttime))
예제 #2
0
def exportSetupMatrices(cursor):
  print("Exporting setup matrices...")
  starttime = time()
  cursor.execute("SELECT name FROM setupmatrix")
  primary_keys = set([ i[0] for i in cursor.fetchall() ])
  cursor.executemany(
    "insert into setupmatrix \
    (name,lastmodified) \
    values(%s,%s)",
    [(
       i.name, timestamp
     ) for i in frepple.setupmatrices() if i.name not in primary_keys
    ])
  cursor.executemany(
    "update setupmatrix \
     set lastmodified=%s \
     where name=%s",
    [(
       timestamp, i.name
     ) for i in frepple.setupmatrices() if i.name in primary_keys
    ])
  transaction.commit(using=database)
  print('Exported setupmatrices in %.2f seconds' % (time() - starttime))
예제 #3
0
def exportSetupMatrices(cursor):
  print("Exporting setup matrices...")
  starttime = time()
  cursor.execute("SELECT name FROM setupmatrix")
  primary_keys = set([ i[0] for i in cursor.fetchall() ])
  cursor.executemany(
    "insert into setupmatrix \
    (name,lastmodified) \
    values(%s,%s)",
    [(
       i.name, timestamp
     ) for i in frepple.setupmatrices() if i.name not in primary_keys
    ])
  cursor.executemany(
    "update setupmatrix \
     set lastmodified=%s \
     where name=%s",
    [(
       timestamp, i.name
     ) for i in frepple.setupmatrices() if i.name in primary_keys
    ])
  transaction.commit(using=database)
  print('Exported setupmatrices in %.2f seconds' % (time() - starttime))
예제 #4
0
 def matrixrules():
   for m in frepple.setupmatrices():
     for i in m.rules:
       yield m, i