X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FTable%2FTableFdf.py;h=80be9532cae10a9dec5a779a835a620cae179575;hp=317bd4149b970ef09a980ca027aa6b56a4f2127e;hb=3d87290487d174656fa6dee9d1f0d82a4c4294b5;hpb=30fdf1140b8d1ce93f3821d986fa165552023440 diff --git a/BaseTools/Source/Python/Table/TableFdf.py b/BaseTools/Source/Python/Table/TableFdf.py index 317bd4149b..80be9532ca 100644 --- a/BaseTools/Source/Python/Table/TableFdf.py +++ b/BaseTools/Source/Python/Table/TableFdf.py @@ -1,8 +1,8 @@ ## @file # This file is used to create/update/query/erase table for fdf datas # -# Copyright (c) 2008, Intel Corporation -# All rights reserved. This program and the accompanying materials +# Copyright (c) 2008 - 2018, 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 # http://opensource.org/licenses/bsd-license.php @@ -14,15 +14,16 @@ ## # Import Modules # +from __future__ import absolute_import import Common.EdkLogger as EdkLogger import CommonDataClass.DataClass as DataClass -from Table import Table -from Common.String import ConvertToSqlString +from .Table import Table +from Common.StringUtils import ConvertToSqlString ## TableFdf # # This class defined a table used for data model -# +# # @param object: Inherited from object class # # @@ -30,7 +31,7 @@ class TableFdf(Table): def __init__(self, Cursor): Table.__init__(self, Cursor) self.Table = 'Fdf' - + ## Create table # # Create table Fdf @@ -55,7 +56,8 @@ class TableFdf(Table): Value1 VARCHAR NOT NULL, Value2 VARCHAR, Value3 VARCHAR, - Arch VarCHAR, + Scope1 VarCHAR, + Scope2 VarCHAR, BelongsToItem SINGLE NOT NULL, BelongsToFile SINGLE NOT NULL, StartLine INTEGER NOT NULL, @@ -84,23 +86,23 @@ class TableFdf(Table): # @param EndColumn: EndColumn of a Fdf item # @param Enabled: If this item enabled # - def Insert(self, Model, Value1, Value2, Value3, Arch, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled): + def Insert(self, Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled): self.ID = self.ID + 1 - (Value1, Value2, Value3, Arch) = ConvertToSqlString((Value1, Value2, Value3, Arch)) - SqlCommand = """insert into %s values(%s, %s, '%s', '%s', '%s', '%s', %s, %s, %s, %s, %s, %s, %s)""" \ - % (self.Table, self.ID, Model, Value1, Value2, Value3, Arch, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled) + (Value1, Value2, Value3, Scope1, Scope2) = ConvertToSqlString((Value1, Value2, Value3, Scope1, Scope2)) + SqlCommand = """insert into %s values(%s, %s, '%s', '%s', '%s', '%s', '%s', %s, %s, %s, %s, %s, %s, %s)""" \ + % (self.Table, self.ID, Model, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine, StartColumn, EndLine, EndColumn, Enabled) Table.Insert(self, SqlCommand) - + return self.ID - + ## Query table # - # @param Model: The Model of Record + # @param Model: The Model of Record # - # @retval: A recordSet of all found records + # @retval: A recordSet of all found records # def Query(self, Model): - SqlCommand = """select ID, Value1, Value2, Value3, Arch, BelongsToItem, BelongsToFile, StartLine from %s + SqlCommand = """select ID, Value1, Value2, Value3, Scope1, Scope2, BelongsToItem, BelongsToFile, StartLine from %s where Model = %s and Enabled > -1""" % (self.Table, Model) EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)