]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Table/TableEotReport.py
2 # This file is used to create/update/query/erase table for ECC reports
4 # Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
5 # SPDX-License-Identifier: BSD-2-Clause-Patent
11 from __future__
import absolute_import
12 import Common
.EdkLogger
as EdkLogger
13 import Common
.LongFilePathOs
as os
, time
14 from Table
.Table
import Table
15 from Common
.StringUtils
import ConvertToSqlString2
16 import Eot
.EotToolError
as EotToolError
17 import Eot
.EotGlobalData
as EotGlobalData
21 # This class defined a table used for data model
23 # @param object: Inherited from object class
26 class TableEotReport(Table
):
27 def __init__(self
, Cursor
):
28 Table
.__init
__(self
, Cursor
)
37 SqlCommand
= """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
38 ModuleID INTEGER DEFAULT -1,
39 ModuleName TEXT DEFAULT '',
40 ModuleGuid TEXT DEFAULT '',
41 SourceFileID INTEGER DEFAULT -1,
42 SourceFileFullPath TEXT DEFAULT '',
43 ItemName TEXT DEFAULT '',
44 ItemType TEXT DEFAULT '',
45 ItemMode TEXT DEFAULT '',
46 GuidName TEXT DEFAULT '',
47 GuidMacro TEXT DEFAULT '',
48 GuidValue TEXT DEFAULT '',
49 BelongsToFunction TEXT DEFAULT '',
50 Enabled INTEGER DEFAULT 0
52 Table
.Create(self
, SqlCommand
)
56 # Insert a record into table report
59 def Insert(self
, ModuleID
= -1, ModuleName
= '', ModuleGuid
= '', SourceFileID
= -1, SourceFileFullPath
= '', \
60 ItemName
= '', ItemType
= '', ItemMode
= '', GuidName
= '', GuidMacro
= '', GuidValue
= '', BelongsToFunction
= '', Enabled
= 0):
62 SqlCommand
= """insert into %s values(%s, %s, '%s', '%s', %s, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %s)""" \
63 % (self
.Table
, self
.ID
, ModuleID
, ModuleName
, ModuleGuid
, SourceFileID
, SourceFileFullPath
, \
64 ItemName
, ItemType
, ItemMode
, GuidName
, GuidMacro
, GuidValue
, BelongsToFunction
, Enabled
)
65 Table
.Insert(self
, SqlCommand
)
68 SqlCommand
= """select max(ID) from %s""" % self
.Table
69 self
.Cur
.execute(SqlCommand
)