]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Table/TableEotReport.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / Table / TableEotReport.py
1 ## @file
2 # This file is used to create/update/query/erase table for ECC reports
3 #
4 # Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
5 # This program and the accompanying materials
6 # are licensed and made available under the terms and conditions of the BSD License
7 # which accompanies this distribution. The full text of the license may be found at
8 # http://opensource.org/licenses/bsd-license.php
9 #
10 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 #
13
14 ##
15 # Import Modules
16 #
17 import Common.EdkLogger as EdkLogger
18 import Common.LongFilePathOs as os, time
19 from Table import Table
20 from Common.StringUtils import ConvertToSqlString2
21 import Eot.EotToolError as EotToolError
22 import Eot.EotGlobalData as EotGlobalData
23
24 ## TableReport
25 #
26 # This class defined a table used for data model
27 #
28 # @param object: Inherited from object class
29 #
30 #
31 class TableEotReport(Table):
32 def __init__(self, Cursor):
33 Table.__init__(self, Cursor)
34 self.Table = 'Report'
35
36 ## Create table
37 #
38 # Create table report
39 #
40 #
41 def Create(self):
42 SqlCommand = """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
43 ModuleID INTEGER DEFAULT -1,
44 ModuleName TEXT DEFAULT '',
45 ModuleGuid TEXT DEFAULT '',
46 SourceFileID INTEGER DEFAULT -1,
47 SourceFileFullPath TEXT DEFAULT '',
48 ItemName TEXT DEFAULT '',
49 ItemType TEXT DEFAULT '',
50 ItemMode TEXT DEFAULT '',
51 GuidName TEXT DEFAULT '',
52 GuidMacro TEXT DEFAULT '',
53 GuidValue TEXT DEFAULT '',
54 BelongsToFunction TEXT DEFAULT '',
55 Enabled INTEGER DEFAULT 0
56 )""" % self.Table
57 Table.Create(self, SqlCommand)
58
59 ## Insert table
60 #
61 # Insert a record into table report
62 #
63 #
64 def Insert(self, ModuleID = -1, ModuleName = '', ModuleGuid = '', SourceFileID = -1, SourceFileFullPath = '', \
65 ItemName = '', ItemType = '', ItemMode = '', GuidName = '', GuidMacro = '', GuidValue = '', BelongsToFunction = '', Enabled = 0):
66 self.ID = self.ID + 1
67 SqlCommand = """insert into %s values(%s, %s, '%s', '%s', %s, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %s)""" \
68 % (self.Table, self.ID, ModuleID, ModuleName, ModuleGuid, SourceFileID, SourceFileFullPath, \
69 ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue, BelongsToFunction, Enabled)
70 Table.Insert(self, SqlCommand)
71
72 def GetMaxID(self):
73 SqlCommand = """select max(ID) from %s""" % self.Table
74 self.Cur.execute(SqlCommand)
75 for Item in self.Cur:
76 return Item[0]