EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

BaseTools/Source/Python/Table/TableEotReport.py

Go to the documentation of this file.
00001 ## @file
00002 # This file is used to create/update/query/erase table for ECC reports
00003 #
00004 # Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
00005 # This program and the accompanying materials
00006 # are licensed and made available under the terms and conditions of the BSD License
00007 # which accompanies this distribution.  The full text of the license may be found at
00008 # http://opensource.org/licenses/bsd-license.php
00009 #
00010 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00011 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00012 #
00013 
00014 ##
00015 # Import Modules
00016 #
00017 import Common.EdkLogger as EdkLogger
00018 import os, time
00019 from Table import Table
00020 from Common.String import ConvertToSqlString2
00021 import Eot.EotToolError as EotToolError
00022 import Eot.EotGlobalData as EotGlobalData
00023 
00024 ## TableReport
00025 #
00026 # This class defined a table used for data model
00027 # 
00028 # @param object:       Inherited from object class
00029 #
00030 #
00031 class TableEotReport(Table):
00032     def __init__(self, Cursor):
00033         Table.__init__(self, Cursor)
00034         self.Table = 'Report'
00035     
00036     ## Create table
00037     #
00038     # Create table report
00039     #
00040     #
00041     def Create(self):
00042         SqlCommand = """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
00043                                                        ModuleID INTEGER DEFAULT -1,
00044                                                        ModuleName TEXT DEFAULT '',
00045                                                        ModuleGuid TEXT DEFAULT '',
00046                                                        SourceFileID INTEGER DEFAULT -1,
00047                                                        SourceFileFullPath TEXT DEFAULT '',
00048                                                        ItemName TEXT DEFAULT '',
00049                                                        ItemType TEXT DEFAULT '',
00050                                                        ItemMode TEXT DEFAULT '',
00051                                                        GuidName TEXT DEFAULT '',
00052                                                        GuidMacro TEXT DEFAULT '',
00053                                                        GuidValue TEXT DEFAULT '',
00054                                                        BelongsToFunction TEXT DEFAULT '',
00055                                                        Enabled INTEGER DEFAULT 0
00056                                                       )""" % self.Table
00057         Table.Create(self, SqlCommand)
00058 
00059     ## Insert table
00060     #
00061     # Insert a record into table report
00062     #
00063     #
00064     def Insert(self, ModuleID = -1, ModuleName = '', ModuleGuid = '', SourceFileID = -1, SourceFileFullPath = '', \
00065                ItemName = '', ItemType = '', ItemMode = '', GuidName = '', GuidMacro = '', GuidValue = '', BelongsToFunction = '', Enabled = 0):
00066         self.ID = self.ID + 1
00067         SqlCommand = """insert into %s values(%s, %s, '%s', '%s', %s, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %s)""" \
00068                      % (self.Table, self.ID, ModuleID, ModuleName, ModuleGuid, SourceFileID, SourceFileFullPath, \
00069                         ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue, BelongsToFunction, Enabled)
00070         Table.Insert(self, SqlCommand)
00071         
00072     def GetMaxID(self):
00073         SqlCommand = """select max(ID) from %s""" % self.Table
00074         self.Cur.execute(SqlCommand)
00075         for Item in self.Cur:
00076             return Item[0]
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines