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