]> git.proxmox.com Git - mirror_edk2.git/blobdiff - 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
diff --git a/BaseTools/Source/Python/Table/TableEotReport.py b/BaseTools/Source/Python/Table/TableEotReport.py
new file mode 100644 (file)
index 0000000..cdae3b2
--- /dev/null
@@ -0,0 +1,76 @@
+## @file\r
+# This file is used to create/update/query/erase table for ECC reports\r
+#\r
+# Copyright (c) 2008, Intel Corporation\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+\r
+##\r
+# Import Modules\r
+#\r
+import Common.EdkLogger as EdkLogger\r
+import os, time\r
+from Table import Table\r
+from Common.String import ConvertToSqlString2\r
+import EotToolError as EotToolError\r
+import EotGlobalData as EotGlobalData\r
+\r
+## TableReport\r
+#\r
+# This class defined a table used for data model\r
+# \r
+# @param object:       Inherited from object class\r
+#\r
+#\r
+class TableEotReport(Table):\r
+    def __init__(self, Cursor):\r
+        Table.__init__(self, Cursor)\r
+        self.Table = 'Report'\r
+    \r
+    ## Create table\r
+    #\r
+    # Create table report\r
+    #\r
+    #\r
+    def Create(self):\r
+        SqlCommand = """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,\r
+                                                       ModuleID INTEGER DEFAULT -1,\r
+                                                       ModuleName TEXT DEFAULT '',\r
+                                                       ModuleGuid TEXT DEFAULT '',\r
+                                                       SourceFileID INTEGER DEFAULT -1,\r
+                                                       SourceFileFullPath TEXT DEFAULT '',\r
+                                                       ItemName TEXT DEFAULT '',\r
+                                                       ItemType TEXT DEFAULT '',\r
+                                                       ItemMode TEXT DEFAULT '',\r
+                                                       GuidName TEXT DEFAULT '',\r
+                                                       GuidMacro TEXT DEFAULT '',\r
+                                                       GuidValue TEXT DEFAULT '',\r
+                                                       BelongsToFunction TEXT DEFAULT '',\r
+                                                       Enabled INTEGER DEFAULT 0\r
+                                                      )""" % self.Table\r
+        Table.Create(self, SqlCommand)\r
+\r
+    ## Insert table\r
+    #\r
+    # Insert a record into table report\r
+    #\r
+    #\r
+    def Insert(self, ModuleID = -1, ModuleName = '', ModuleGuid = '', SourceFileID = -1, SourceFileFullPath = '', \\r
+               ItemName = '', ItemType = '', ItemMode = '', GuidName = '', GuidMacro = '', GuidValue = '', BelongsToFunction = '', Enabled = 0):\r
+        self.ID = self.ID + 1\r
+        SqlCommand = """insert into %s values(%s, %s, '%s', '%s', %s, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %s)""" \\r
+                     % (self.Table, self.ID, ModuleID, ModuleName, ModuleGuid, SourceFileID, SourceFileFullPath, \\r
+                        ItemName, ItemType, ItemMode, GuidName, GuidMacro, GuidValue, BelongsToFunction, Enabled)\r
+        Table.Insert(self, SqlCommand)\r
+        \r
+    def GetMaxID(self):\r
+        SqlCommand = """select max(ID) from %s""" % self.Table\r
+        self.Cur.execute(SqlCommand)\r
+        for Item in self.Cur:\r
+            return Item[0]
\ No newline at end of file