## @file
#
# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
##
# Import Modules
#
import os
## Convert to SQL required string format
## TableFile
#
# This class defined a common table
#
# @param object: Inherited from object class
#
# @param Cursor: Cursor of the database
# @param TableName: Name of the table
#
## Create table
#
# Create a table
#
if NewTable:
else:
## Insert table
#
# Insert a record into a table
#
## Query table
#
# Query all records of the table
#
## Drop a table
#
# Drop the table
#
## Get count
#
# Get a count of all records of the table
#
# @retval Count: Total count of all records
#
if Id == None:
return Id
## Init the ID of the table
#
# Init the ID of the table
#
## Exec
#
# Exec Sql Command, return result
#
# @param SqlCommand: The SqlCommand to be executed
#
# @retval RecordSet: The result after executed
#
return RecordSet
#
# Need to execution commit for table data changed.
#
return False
return True
## TableFile
#
# This class defined a table used for file
#
# @param object: Inherited from object class
#
_COLUMN_ = '''
ID INTEGER PRIMARY KEY,
Name VARCHAR NOT NULL,
ExtName VARCHAR,
Path VARCHAR,
FullPath VARCHAR NOT NULL,
Model INTEGER DEFAULT 0,
TimeStamp SINGLE NOT NULL
'''
## Insert table
#
# Insert a record into table File
#
# @param Name: Name of a File
# @param ExtName: ExtName of a File
# @param Path: Path of a File
# @param FullPath: FullPath of a File
# @param Model: Model of a File
# @param TimeStamp: TimeStamp of a File
#
self,
Name,
Path,
)
## InsertFile
#
# Insert one file to table
#
# @param FileFullPath: The full path of the file
# @param Model: The model of the file
#
# @retval FileID: The ID after record is inserted
#
)
## Get ID of a given file
#
# @param FilePath Path of file
#
# @retval ID ID value of given file in the table
#
return None
## Get type of a given file
#
# @param FileId ID of a file
#
# @retval file_type Model value of given file in the table
#
return None
## Get file timestamp of a given file
#
# @param FileId ID of file
#
# @retval timestamp TimeStamp value of given file in the table
#
return None
## Update the timestamp of a given file
#
# @param FileId ID of file
# @param TimeStamp Time stamp of file
#
## Get list of file with given type
#
# @param FileType Type value of file
#
# @retval file_list List of files with the given type
#
return []
return [R[0] for R in RecordList]
## TableDataModel
#
# This class defined a table used for data model
#
# @param object: Inherited from object class
#
#
_COLUMN_ = """
ID INTEGER PRIMARY KEY,
CrossIndex INTEGER NOT NULL,
Name VARCHAR NOT NULL,
Description VARCHAR
"""
## Insert table
#
# Insert a record into table DataModel
#
# @param ID: ID of a ModelType
# @param CrossIndex: CrossIndex of a ModelType
# @param Name: Name of a ModelType
# @param Description: Description of a ModelType
#
## Init table
#
# Create all default records of table DataModel
#
return
## Get CrossIndex
#
# Get a model's cross index from its name
#
# @param ModelName: Name of the model
# @retval CrossIndex: CrossIndex of the model
#
CrossIndex = -1
return CrossIndex