]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Workspace/MetaDataTable.py
Sync BaseTools Trunk (version r2387) to EDKII main trunk.
[mirror_edk2.git] / BaseTools / Source / Python / Workspace / MetaDataTable.py
index 64f0480c37e860d39c9a469c1702d194bde9d12a..34ef4903df16625d49178a2e11fd52c883e87384 100644 (file)
@@ -140,6 +140,10 @@ class Table(object):
 \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
@@ -147,6 +151,9 @@ class Table(object):
             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
@@ -198,19 +205,15 @@ class TableFile(Table):
     #\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
@@ -218,8 +221,8 @@ class TableFile(Table):
     #\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