]>
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 import Common
.EdkLogger
as EdkLogger
18 from Common
.String
import ConvertToSqlString
19 from Table
import Table
23 # This class defined a table used for Query
25 # @param object: Inherited from object class
28 class TableQuery(Table
):
29 def __init__(self
, Cursor
):
30 Table
.__init
__(self
, Cursor
)
37 # @param ID: ID of a Query
38 # @param Name: Name of a Query
39 # @param Modifer: Modifier of a Query
40 # @param Value: Type of a Query
41 # @param Model: Model of a Query
44 SqlCommand
= """create table IF NOT EXISTS %s(ID INTEGER PRIMARY KEY,
46 Modifier TEXT DEFAULT '',
47 Value TEXT DEFAULT '',
48 Model INTEGER DEFAULT 0
50 Table
.Create(self
, SqlCommand
)
54 # Insert a record into table Query
56 # @param ID: ID of a Query
57 # @param Name: Name of a Query
58 # @param Modifier: Modifier of a Query
59 # @param Value: Value of a Query
60 # @param Model: Model of a Query
62 def Insert(self
, Name
, Modifier
, Value
, Model
):
64 SqlCommand
= """insert into %s values(%s, '%s', '%s', '%s', %s)""" \
65 % (self
.Table
, self
.ID
, Name
, Modifier
, Value
, Model
)
66 Table
.Insert(self
, SqlCommand
)