]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Table/TablePcd.py
caa82b7324f234fe476db76cfde2d7fe2465f372
2 # This file is used to create/update/query/erase table for pcds
4 # Copyright (c) 2008 - 2018, 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 Table
.Table
import Table
19 from Common
.StringUtils
import ConvertToSqlString
23 # This class defined a table used for pcds
25 # @param object: Inherited from object class
28 class TablePcd(Table
):
29 def __init__(self
, Cursor
):
30 Table
.__init
__(self
, Cursor
)
37 # @param ID: ID of a Pcd
38 # @param CName: CName of a Pcd
39 # @param TokenSpaceGuidCName: TokenSpaceGuidCName of a Pcd
40 # @param Token: Token of a Pcd
41 # @param DatumType: DatumType of a Pcd
42 # @param Model: Model of a Pcd
43 # @param BelongsToFile: The Pcd belongs to which file
44 # @param BelongsToFunction: The Pcd belongs to which function
45 # @param StartLine: StartLine of a Pcd
46 # @param StartColumn: StartColumn of a Pcd
47 # @param EndLine: EndLine of a Pcd
48 # @param EndColumn: EndColumn of a Pcd
51 SqlCommand
= """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
52 CName VARCHAR NOT NULL,
53 TokenSpaceGuidCName VARCHAR NOT NULL,
56 Model INTEGER NOT NULL,
57 BelongsToFile SINGLE NOT NULL,
58 BelongsToFunction SINGLE DEFAULT -1,
59 StartLine INTEGER NOT NULL,
60 StartColumn INTEGER NOT NULL,
61 EndLine INTEGER NOT NULL,
62 EndColumn INTEGER NOT NULL
64 Table
.Create(self
, SqlCommand
)
68 # Insert a record into table Pcd
70 # @param ID: ID of a Pcd
71 # @param CName: CName of a Pcd
72 # @param TokenSpaceGuidCName: TokenSpaceGuidCName of a Pcd
73 # @param Token: Token of a Pcd
74 # @param DatumType: DatumType of a Pcd
75 # @param Model: Model of a Pcd
76 # @param BelongsToFile: The Pcd belongs to which file
77 # @param BelongsToFunction: The Pcd belongs to which function
78 # @param StartLine: StartLine of a Pcd
79 # @param StartColumn: StartColumn of a Pcd
80 # @param EndLine: EndLine of a Pcd
81 # @param EndColumn: EndColumn of a Pcd
83 def Insert(self
, CName
, TokenSpaceGuidCName
, Token
, DatumType
, Model
, BelongsToFile
, BelongsToFunction
, StartLine
, StartColumn
, EndLine
, EndColumn
):
85 (CName
, TokenSpaceGuidCName
, DatumType
) = ConvertToSqlString((CName
, TokenSpaceGuidCName
, DatumType
))
86 SqlCommand
= """insert into %s values(%s, '%s', '%s', %s, '%s', %s, %s, %s, %s, %s, %s, %s)""" \
87 % (self
.Table
, self
.ID
, CName
, TokenSpaceGuidCName
, Token
, DatumType
, Model
, BelongsToFile
, BelongsToFunction
, StartLine
, StartColumn
, EndLine
, EndColumn
)
88 Table
.Insert(self
, SqlCommand
)