## @file\r
# This file is used to create/update/query/erase table for files\r
#\r
-# Copyright (c) 2008, Intel Corporation\r
-# All rights reserved. This program and the accompanying materials\r
+# Copyright (c) 2008 - 2014, 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
# http://opensource.org/licenses/bsd-license.php\r
import Common.EdkLogger as EdkLogger\r
from Table import Table\r
from Common.String import ConvertToSqlString\r
-import os\r
+import Common.LongFilePathOs as os\r
from CommonDataClass.DataClass import FileClass\r
\r
## TableFile\r
TimeStamp = os.stat(FileFullPath)[8]\r
File = FileClass(-1, Name, Ext, Filepath, FileFullPath, Model, '', [], [], [])\r
return self.Insert(File.Name, File.ExtName, File.Path, File.FullPath, File.Model, TimeStamp)\r
+ \r
+ ## Get ID of a given file\r
+ #\r
+ # @param FilePath Path of file\r
+ #\r
+ # @retval ID ID value of given file in the table\r
+ #\r
+ def GetFileId(self, File):\r
+ QueryScript = "select ID from %s where FullPath = '%s'" % (self.Table, str(File))\r
+ RecordList = self.Exec(QueryScript)\r
+ if len(RecordList) == 0:\r
+ return None\r
+ return RecordList[0][0]\r