## @file\r
# This file is used to create/update/query/erase table for files\r
#\r
-# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>\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
##\r
# Import Modules\r
#\r
-import os\r
+import Common.LongFilePathOs as os\r
\r
import Common.EdkLogger as EdkLogger\r
from CommonDataClass import DataClass\r
\r
def SetEndFlag(self):\r
self.Exec("insert into %s values(%s)" % (self.Table, self._DUMMY_))\r
+ #\r
+ # Need to execution commit for table data changed.\r
+ #\r
+ self.Cur.connection.commit()\r
\r
def IsIntegral(self):\r
Result = self.Exec("select min(ID) from %s" % (self.Table))\r
return False\r
return True\r
\r
+ def GetAll(self):\r
+ return self.Exec("select * from %s where ID > 0 order by ID" % (self.Table))\r
+\r
## TableFile\r
#\r
# This class defined a table used for file\r
#\r
# @retval FileID: The ID after record is inserted\r
#\r
- def InsertFile(self, FileFullPath, Model):\r
- (Filepath, Name) = os.path.split(FileFullPath)\r
- (Root, Ext) = os.path.splitext(FileFullPath)\r
- TimeStamp = os.stat(FileFullPath)[8]\r
- File = FileClass(-1, Name, Ext, Filepath, FileFullPath, Model, '', [], [], [])\r
+ def InsertFile(self, File, Model):\r
return self.Insert(\r
- Name,\r
- Ext,\r
- Filepath,\r
- FileFullPath,\r
- Model,\r
- TimeStamp\r
- )\r
+ File.Name,\r
+ File.Ext,\r
+ File.Dir,\r
+ File.Path,\r
+ Model,\r
+ File.TimeStamp\r
+ )\r
\r
## Get ID of a given file\r
#\r
#\r
# @retval ID ID value of given file in the table\r
#\r
- def GetFileId(self, FilePath):\r
- QueryScript = "select ID from %s where FullPath = '%s'" % (self.Table, FilePath)\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