]>
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 # SPDX-License-Identifier: BSD-2-Clause-Patent
11 from __future__
import absolute_import
12 import Common
.EdkLogger
as EdkLogger
13 from Common
.StringUtils
import ConvertToSqlString
14 from Table
.Table
import Table
18 # This class defined a table used for Query
20 # @param object: Inherited from object class
23 class TableQuery(Table
):
24 def __init__(self
, Cursor
):
25 Table
.__init
__(self
, Cursor
)
32 # @param ID: ID of a Query
33 # @param Name: Name of a Query
34 # @param Modifier: Modifier of a Query
35 # @param Value: Type of a Query
36 # @param Model: Model of a Query
39 SqlCommand
= """create table IF NOT EXISTS %s(ID INTEGER PRIMARY KEY,
41 Modifier TEXT DEFAULT '',
42 Value TEXT DEFAULT '',
43 Model INTEGER DEFAULT 0
45 Table
.Create(self
, SqlCommand
)
49 # Insert a record into table Query
51 # @param ID: ID of a Query
52 # @param Name: Name of a Query
53 # @param Modifier: Modifier of a Query
54 # @param Value: Value of a Query
55 # @param Model: Model of a Query
57 def Insert(self
, Name
, Modifier
, Value
, Model
):
59 SqlCommand
= """insert into %s values(%s, '%s', '%s', '%s', %s)""" \
60 % (self
.Table
, self
.ID
, Name
, Modifier
, Value
, Model
)
61 Table
.Insert(self
, SqlCommand
)