]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Table/TablePcd.py
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 from __future__
import absolute_import
18 import Common
.EdkLogger
as EdkLogger
19 from Table
.Table
import Table
20 from Common
.StringUtils
import ConvertToSqlString
24 # This class defined a table used for pcds
26 # @param object: Inherited from object class
29 class TablePcd(Table
):
30 def __init__(self
, Cursor
):
31 Table
.__init
__(self
, Cursor
)
38 # @param ID: ID of a Pcd
39 # @param CName: CName of a Pcd
40 # @param TokenSpaceGuidCName: TokenSpaceGuidCName of a Pcd
41 # @param Token: Token of a Pcd
42 # @param DatumType: DatumType of a Pcd
43 # @param Model: Model of a Pcd
44 # @param BelongsToFile: The Pcd belongs to which file
45 # @param BelongsToFunction: The Pcd belongs to which function
46 # @param StartLine: StartLine of a Pcd
47 # @param StartColumn: StartColumn of a Pcd
48 # @param EndLine: EndLine of a Pcd
49 # @param EndColumn: EndColumn of a Pcd
52 SqlCommand
= """create table IF NOT EXISTS %s (ID INTEGER PRIMARY KEY,
53 CName VARCHAR NOT NULL,
54 TokenSpaceGuidCName VARCHAR NOT NULL,
57 Model INTEGER NOT NULL,
58 BelongsToFile SINGLE NOT NULL,
59 BelongsToFunction SINGLE DEFAULT -1,
60 StartLine INTEGER NOT NULL,
61 StartColumn INTEGER NOT NULL,
62 EndLine INTEGER NOT NULL,
63 EndColumn INTEGER NOT NULL
65 Table
.Create(self
, SqlCommand
)
69 # Insert a record into table Pcd
71 # @param ID: ID of a Pcd
72 # @param CName: CName of a Pcd
73 # @param TokenSpaceGuidCName: TokenSpaceGuidCName of a Pcd
74 # @param Token: Token of a Pcd
75 # @param DatumType: DatumType of a Pcd
76 # @param Model: Model of a Pcd
77 # @param BelongsToFile: The Pcd belongs to which file
78 # @param BelongsToFunction: The Pcd belongs to which function
79 # @param StartLine: StartLine of a Pcd
80 # @param StartColumn: StartColumn of a Pcd
81 # @param EndLine: EndLine of a Pcd
82 # @param EndColumn: EndColumn of a Pcd
84 def Insert(self
, CName
, TokenSpaceGuidCName
, Token
, DatumType
, Model
, BelongsToFile
, BelongsToFunction
, StartLine
, StartColumn
, EndLine
, EndColumn
):
86 (CName
, TokenSpaceGuidCName
, DatumType
) = ConvertToSqlString((CName
, TokenSpaceGuidCName
, DatumType
))
87 SqlCommand
= """insert into %s values(%s, '%s', '%s', %s, '%s', %s, %s, %s, %s, %s, %s, %s)""" \
88 % (self
.Table
, self
.ID
, CName
, TokenSpaceGuidCName
, Token
, DatumType
, Model
, BelongsToFile
, BelongsToFunction
, StartLine
, StartColumn
, EndLine
, EndColumn
)
89 Table
.Insert(self
, SqlCommand
)