]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Table/TableQuery.py
2 # This file is used to create/update/query/erase table for Queries
4 # Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
5 # This program and the accompanying materials
6 # are licensed and made available under the terms and conditions of the BSD License
7 # which accompanies this distribution. The full text of the license may be found at
8 # http://opensource.org/licenses/bsd-license.php
10 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 from __future__
import absolute_import
18 import Common
.EdkLogger
as EdkLogger
19 from Common
.StringUtils
import ConvertToSqlString
20 from Table
.Table
import Table
24 # This class defined a table used for Query
26 # @param object: Inherited from object class
29 class TableQuery(Table
):
30 def __init__(self
, Cursor
):
31 Table
.__init
__(self
, Cursor
)
38 # @param ID: ID of a Query
39 # @param Name: Name of a Query
40 # @param Modifer: Modifier of a Query
41 # @param Value: Type of a Query
42 # @param Model: Model of a Query
45 SqlCommand
= """create table IF NOT EXISTS %s(ID INTEGER PRIMARY KEY,
47 Modifier TEXT DEFAULT '',
48 Value TEXT DEFAULT '',
49 Model INTEGER DEFAULT 0
51 Table
.Create(self
, SqlCommand
)
55 # Insert a record into table Query
57 # @param ID: ID of a Query
58 # @param Name: Name of a Query
59 # @param Modifier: Modifier of a Query
60 # @param Value: Value of a Query
61 # @param Model: Model of a Query
63 def Insert(self
, Name
, Modifier
, Value
, Model
):
65 SqlCommand
= """insert into %s values(%s, '%s', '%s', '%s', %s)""" \
66 % (self
.Table
, self
.ID
, Name
, Modifier
, Value
, Model
)
67 Table
.Insert(self
, SqlCommand
)