## @file\r
# This file is used to create/update/query/erase a common table\r
#\r
-# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2008 - 2018, 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
## TableFile\r
#\r
# This class defined a common table\r
-# \r
+#\r
# @param object: Inherited from object class\r
#\r
# @param Cursor: Cursor of the database\r
self.Cur = Cursor\r
self.Table = ''\r
self.ID = 0\r
- \r
+\r
## Create table\r
#\r
# Create a table\r
#\r
def Insert(self, SqlCommand):\r
self.Exec(SqlCommand)\r
- \r
+\r
## Query table\r
#\r
# Query all records of the table\r
- # \r
+ #\r
def Query(self):\r
EdkLogger.verbose("\nQuery tabel %s started ..." % self.Table)\r
SqlCommand = """select * from %s""" % self.Table\r
self.Cur.execute(SqlCommand)\r
for Rs in self.Cur:\r
EdkLogger.verbose(str(Rs))\r
- \r
+\r
TotalCount = self.GetCount()\r
EdkLogger.verbose("*** Total %s records in table %s ***" % (TotalCount, self.Table) )\r
EdkLogger.verbose("Query tabel %s DONE!" % self.Table)\r
SqlCommand = """drop table IF EXISTS %s""" % self.Table\r
self.Cur.execute(SqlCommand)\r
EdkLogger.verbose("Drop tabel %s ... DONE!" % self.Table)\r
- \r
+\r
## Get count\r
#\r
# Get a count of all records of the table\r
self.Cur.execute(SqlCommand)\r
for Item in self.Cur:\r
return Item[0]\r
- \r
+\r
## Generate ID\r
#\r
# Generate an ID if input ID is -1\r
#\r
- # @param ID: Input ID \r
+ # @param ID: Input ID\r
#\r
# @retval ID: New generated ID\r
#\r
self.ID = self.ID + 1\r
\r
return self.ID\r
- \r
+\r
## Init the ID of the table\r
#\r
# Init the ID of the table\r
#\r
def InitID(self):\r
self.ID = self.GetCount()\r
- \r
+\r
## Exec\r
#\r
# Exec Sql Command, return result\r