]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Table/TableFdf.py
BaseTools: Use absolute import in Table
[mirror_edk2.git] / BaseTools / Source / Python / Table / TableFdf.py
index 5fb8cd82322c54a15dfee508dddccd070f5e21f7..80be9532cae10a9dec5a779a835a620cae179575 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file is used to create/update/query/erase table for fdf datas\r
 #\r
-# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
 # 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
 ##\r
 # Import Modules\r
 #\r
+from __future__ import absolute_import\r
 import Common.EdkLogger as EdkLogger\r
 import CommonDataClass.DataClass as DataClass\r
-from Table import Table\r
-from Common.String import ConvertToSqlString\r
+from .Table import Table\r
+from Common.StringUtils import ConvertToSqlString\r
 \r
 ## TableFdf\r
 #\r
 # This class defined a table used for data model\r
-# \r
+#\r
 # @param object:       Inherited from object class\r
 #\r
 #\r
@@ -30,7 +31,7 @@ class TableFdf(Table):
     def __init__(self, Cursor):\r
         Table.__init__(self, Cursor)\r
         self.Table = 'Fdf'\r
-    \r
+\r
     ## Create table\r
     #\r
     # Create table Fdf\r
@@ -55,7 +56,8 @@ class TableFdf(Table):
                                                        Value1 VARCHAR NOT NULL,\r
                                                        Value2 VARCHAR,\r
                                                        Value3 VARCHAR,\r
-                                                       Arch VarCHAR,\r
+                                                       Scope1 VarCHAR,\r
+                                                       Scope2 VarCHAR,\r
                                                        BelongsToItem SINGLE NOT NULL,\r
                                                        BelongsToFile SINGLE NOT NULL,\r
                                                        StartLine INTEGER NOT NULL,\r
@@ -84,23 +86,23 @@ class TableFdf(Table):
     # @param EndColumn:      EndColumn of a Fdf item\r
     # @param Enabled:        If this item enabled\r
     #\r
-    def Insert(self, Model, Value1, Value2, Value3, Arch, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled):\r
+    def Insert(self, Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled):\r
         self.ID = self.ID + 1\r
-        (Value1, Value2, Value3, Arch) = ConvertToSqlString((Value1, Value2, Value3, Arch))\r
-        SqlCommand = """insert into %s values(%s, %s, '%s', '%s', '%s', '%s', %s, %s, %s, %s, %s, %s, %s)""" \\r
-                     % (self.Table, self.ID, Model, Value1, Value2, Value3, Arch, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled)\r
+        (Value1, Value2, Value3, Scope1, Scope2) = ConvertToSqlString((Value1, Value2, Value3, Scope1, Scope2))\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, Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled)\r
         Table.Insert(self, SqlCommand)\r
-        \r
+\r
         return self.ID\r
-    \r
+\r
     ## Query table\r
     #\r
-    # @param Model:  The Model of Record \r
+    # @param Model:  The Model of Record\r
     #\r
-    # @retval:       A recordSet of all found records \r
+    # @retval:       A recordSet of all found records\r
     #\r
     def Query(self, Model):\r
-        SqlCommand = """select ID, Value1, Value2, Value3, Arch, BelongsToItem, BelongsToFile, StartLine from %s\r
+        SqlCommand = """select ID, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine from %s\r
                         where Model = %s\r
                         and Enabled > -1""" % (self.Table, Model)\r
         EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)\r