]>
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 - 2014, 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
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.
17 import Common
.EdkLogger
as EdkLogger
18 import Common
.LongFilePathOs
as os
, time
19 from Table
import Table
20 from Common
.String
import ConvertToSqlString2
21 import Eot
.EotToolError
as EotToolError
22 import Eot
.EotGlobalData
as EotGlobalData
26 # This class defined a table used for data model
28 # @param object: Inherited from object class
31 class TableEotReport(Table
):
32 def __init__(self
, Cursor
):
33 Table
.__init
__(self
, Cursor
)
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
57 Table
.Create(self
, SqlCommand
)
61 # Insert a record into table report
64 def Insert(self
, ModuleID
= -1, ModuleName
= '', ModuleGuid
= '', SourceFileID
= -1, SourceFileFullPath
= '', \
65 ItemName
= '', ItemType
= '', ItemMode
= '', GuidName
= '', GuidMacro
= '', GuidValue
= '', BelongsToFunction
= '', Enabled
= 0):
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
)
73 SqlCommand
= """select max(ID) from %s""" % self
.Table
74 self
.Cur
.execute(SqlCommand
)