X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FTable%2FTableReport.py;h=9ce1d0aa25182a1e4920da8da7d3894ab402d42b;hp=2e7fd539f7ee7a8d3538585a39de8d77aa941938;hb=92beb1e4c73a40a708c7c0cade5c7cee314b3887;hpb=40d841f6a8f84e75409178e19e69b95e01bada0f
diff --git a/BaseTools/Source/Python/Table/TableReport.py b/BaseTools/Source/Python/Table/TableReport.py
index 2e7fd539f7..9ce1d0aa25 100644
--- a/BaseTools/Source/Python/Table/TableReport.py
+++ b/BaseTools/Source/Python/Table/TableReport.py
@@ -1,7 +1,7 @@
## @file
# This file is used to create/update/query/erase table for ECC reports
#
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -15,11 +15,12 @@
# Import Modules
#
import Common.EdkLogger as EdkLogger
-import os, time
+import Common.LongFilePathOs as os, time
from Table import Table
-from Common.String import ConvertToSqlString2
+from Common.StringUtils import ConvertToSqlString2
import EccToolError as EccToolError
import EccGlobalData as EccGlobalData
+from Common.LongFilePathSupport import OpenLongFilePath as open
## TableReport
#
@@ -67,14 +68,14 @@ class TableReport(Table):
# @param Enabled: If this error enabled
# @param Corrected: if this error corrected
#
- def Insert(self, ErrorID, OtherMsg = '', BelongsToTable = '', BelongsToItem = -1, Enabled = 0, Corrected = -1):
+ def Insert(self, ErrorID, OtherMsg='', BelongsToTable='', BelongsToItem= -1, Enabled=0, Corrected= -1):
self.ID = self.ID + 1
SqlCommand = """insert into %s values(%s, %s, '%s', '%s', %s, %s, %s)""" \
% (self.Table, self.ID, ErrorID, ConvertToSqlString2(OtherMsg), BelongsToTable, BelongsToItem, Enabled, Corrected)
Table.Insert(self, SqlCommand)
-
+
return self.ID
-
+
## Query table
#
# @retval: A recordSet of all found records
@@ -84,13 +85,20 @@ class TableReport(Table):
where Enabled > -1 order by ErrorID, BelongsToItem""" % (self.Table)
return self.Exec(SqlCommand)
+ ## Update table
+ #
+ def UpdateBelongsToItemByFile(self, ItemID=-1, File=""):
+ SqlCommand = """update Report set BelongsToItem=%s where BelongsToTable='File' and BelongsToItem=-2
+ and OtherMsg like '%%%s%%'""" % (ItemID, File)
+ return self.Exec(SqlCommand)
+
## Convert to CSV
#
# Get all enabled records from table report and save them to a .csv file
#
# @param Filename: To filename to save the report content
#
- def ToCSV(self, Filename = 'Report.csv'):
+ def ToCSV(self, Filename='Report.csv'):
try:
File = open(Filename, 'w+')
File.write("""No, Error Code, Error Message, File, LineNo, Other Error Message\n""")
@@ -115,7 +123,7 @@ class TableReport(Table):
if NewRecord != []:
File.write("""%s,%s,"%s",%s,%s,"%s"\n""" % (Index, ErrorID, EccToolError.gEccErrorMessage[ErrorID], NewRecord[0][1], NewRecord[0][0], OtherMsg))
EdkLogger.quiet("%s(%s): [%s]%s %s" % (NewRecord[0][1], NewRecord[0][0], ErrorID, EccToolError.gEccErrorMessage[ErrorID], OtherMsg))
-
+
File.close()
except IOError:
NewFilename = 'Report_' + time.strftime("%Y%m%d_%H%M%S.csv", time.localtime())