MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / IpiDatabase

Class IpiDatabase

BaseTools/Source/Python/UPT/Core/IpiDb.py:36–918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34#
35#
36class IpiDatabase(object):
37 def __init__(self, DbPath, Workspace):
38 Dir = os.path.dirname(DbPath)
39 if not os.path.isdir(Dir):
40 os.mkdir(Dir)
41 self.Conn = sqlite3.connect(u''.join(DbPath), isolation_level='DEFERRED')
42 self.Conn.execute("PRAGMA page_size=4096")
43 self.Conn.execute("PRAGMA synchronous=OFF")
44 self.Cur = self.Conn.cursor()
45 self.DpTable = 'DpInfo'
46 self.PkgTable = 'PkgInfo'
47 self.ModInPkgTable = 'ModInPkgInfo'
48 self.StandaloneModTable = 'StandaloneModInfo'
49 self.ModDepexTable = 'ModDepexInfo'
50 self.DpFileListTable = 'DpFileListInfo'
51 self.DummyTable = 'Dummy'
52 self.Workspace = os.path.normpath(Workspace)
53
54 ## Initialize build database
55 #
56 #
57 def InitDatabase(self, SkipLock = False):
58 Logger.Verbose(ST.MSG_INIT_IPI_START)
59 if not SkipLock:
60 try:
61 #
62 # Create a dummy table, if already existed,
63 # then UPT is already running
64 #
65 SqlCommand = """
66 create table %s (
67 Dummy TEXT NOT NULL,
68 PRIMARY KEY (Dummy)
69 )""" % self.DummyTable
70 self.Cur.execute(SqlCommand)
71 self.Conn.commit()
72 except sqlite3.OperationalError:
73 Logger.Error("UPT",
74 UPT_ALREADY_RUNNING_ERROR,
75 ST.ERR_UPT_ALREADY_RUNNING_ERROR
76 )
77
78 #
79 # Create new table
80 #
81 SqlCommand = """
82 create table IF NOT EXISTS %s (
83 DpGuid TEXT NOT NULL,DpVersion TEXT NOT NULL,
84 InstallTime REAL NOT NULL,
85 NewPkgFileName TEXT NOT NULL,
86 PkgFileName TEXT NOT NULL,
87 RePackage TEXT NOT NULL,
88 PRIMARY KEY (DpGuid, DpVersion)
89 )""" % self.DpTable
90 self.Cur.execute(SqlCommand)
91
92 SqlCommand = """
93 create table IF NOT EXISTS %s (

Callers 1

MainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected