summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/Table
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-12-07 06:19:28 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2011-12-07 06:19:28 +0000
commitd0acc87a41d9aa25fe87eb096efa62afacd1f865 (patch)
tree4430e100da50ce255ab37dc6ba09e8ff11252443 /BaseTools/Source/Python/Table
parentb7891584a58d5e5e26f35c0944cae5f03efd880b (diff)
downloadedk2-platforms-d0acc87a41d9aa25fe87eb096efa62afacd1f865.tar.xz
Sync BaseTool trunk (version r2460) into EDKII BaseTools. The change mainly includes:
1. Support use expression as DSC file PCD value. 2. Update FDF parser to fix bug to get complete macro value. 3. Fix bug to replace SET statement macro and evaluate SET statement PCD value in FDF file. 4. Fix a bug for MACRO defined in conditional block cannot be processed correctly Signed-off-by: lgao4 Reviewed-by: gikidy git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12827 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/Table')
-rw-r--r--BaseTools/Source/Python/Table/TableFdf.py13
-rw-r--r--BaseTools/Source/Python/Table/TableFile.py13
2 files changed, 20 insertions, 6 deletions
diff --git a/BaseTools/Source/Python/Table/TableFdf.py b/BaseTools/Source/Python/Table/TableFdf.py
index 5fb8cd8232..927b5d1a3b 100644
--- a/BaseTools/Source/Python/Table/TableFdf.py
+++ b/BaseTools/Source/Python/Table/TableFdf.py
@@ -55,7 +55,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,11 +85,11 @@ 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
@@ -100,7 +101,7 @@ class TableFdf(Table):
# @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)
diff --git a/BaseTools/Source/Python/Table/TableFile.py b/BaseTools/Source/Python/Table/TableFile.py
index 86dddd0f2b..e43802ef25 100644
--- a/BaseTools/Source/Python/Table/TableFile.py
+++ b/BaseTools/Source/Python/Table/TableFile.py
@@ -89,3 +89,16 @@ class TableFile(Table):
TimeStamp = os.stat(FileFullPath)[8]
File = FileClass(-1, Name, Ext, Filepath, FileFullPath, Model, '', [], [], [])
return self.Insert(File.Name, File.ExtName, File.Path, File.FullPath, File.Model, TimeStamp)
+
+ ## Get ID of a given file
+ #
+ # @param FilePath Path of file
+ #
+ # @retval ID ID value of given file in the table
+ #
+ def GetFileId(self, File):
+ QueryScript = "select ID from %s where FullPath = '%s'" % (self.Table, str(File))
+ RecordList = self.Exec(QueryScript)
+ if len(RecordList) == 0:
+ return None
+ return RecordList[0][0]