]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Table/TableIdentifier.py
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / BaseTools / Source / Python / Table / TableIdentifier.py
1 ## @file
2 # This file is used to create/update/query/erase table for Identifiers
3 #
4 # Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
5 # SPDX-License-Identifier: BSD-2-Clause-Patent
6 #
7
8 ##
9 # Import Modules
10 #
11 from __future__ import absolute_import
12 import Common.EdkLogger as EdkLogger
13 from Common.StringUtils import ConvertToSqlString
14 from Table.Table import Table
15
16 ## TableIdentifier
17 #
18 # This class defined a table used for Identifier
19 #
20 # @param object: Inherited from object class
21 #
22 #
23 class TableIdentifier(Table):
24 def __init__(self, Cursor):
25 Table.__init__(self, Cursor)
26 self.Table = 'Identifier'
27
28 ## Create table
29 #
30 # Create table Identifier
31 #
32 # @param ID: ID of a Identifier
33 # @param Modifier: Modifier of a Identifier
34 # @param Type: Type of a Identifier
35 # @param Name: Name of a Identifier
36 # @param Value: Value of a Identifier
37 # @param Model: Model of a Identifier
38 # @param BelongsToFile: The Identifier belongs to which file
39 # @param BelongsToFunction: The Identifier belongs to which function
40 # @param StartLine: StartLine of a Identifier
41 # @param StartColumn: StartColumn of a Identifier
42 # @param EndLine: EndLine of a Identifier
43 # @param EndColumn: EndColumn of a Identifier
44 #
45 def Create(self):
46 SqlCommand = """create table IF NOT EXISTS %s(ID INTEGER PRIMARY KEY,
47 Modifier VARCHAR,
48 Type VARCHAR,
49 Name VARCHAR NOT NULL,
50 Value VARCHAR NOT NULL,
51 Model INTEGER NOT NULL,
52 BelongsToFile SINGLE NOT NULL,
53 BelongsToFunction SINGLE DEFAULT -1,
54 StartLine INTEGER NOT NULL,
55 StartColumn INTEGER NOT NULL,
56 EndLine INTEGER NOT NULL,
57 EndColumn INTEGER NOT NULL
58 )""" % self.Table
59 Table.Create(self, SqlCommand)
60
61 ## Insert table
62 #
63 # Insert a record into table Identifier
64 #
65 # @param ID: ID of a Identifier
66 # @param Modifier: Modifier of a Identifier
67 # @param Type: Type of a Identifier
68 # @param Name: Name of a Identifier
69 # @param Value: Value of a Identifier
70 # @param Model: Model of a Identifier
71 # @param BelongsToFile: The Identifier belongs to which file
72 # @param BelongsToFunction: The Identifier belongs to which function
73 # @param StartLine: StartLine of a Identifier
74 # @param StartColumn: StartColumn of a Identifier
75 # @param EndLine: EndLine of a Identifier
76 # @param EndColumn: EndColumn of a Identifier
77 #
78 def Insert(self, Modifier, Type, Name, Value, Model, BelongsToFile, BelongsToFunction, StartLine, StartColumn, EndLine, EndColumn):
79 self.ID = self.ID + 1
80 (Modifier, Type, Name, Value) = ConvertToSqlString((Modifier, Type, Name, Value))
81 SqlCommand = """insert into %s values(%s, '%s', '%s', '%s', '%s', %s, %s, %s, %s, %s, %s, %s)""" \
82 % (self.Table, self.ID, Modifier, Type, Name, Value, Model, BelongsToFile, BelongsToFunction, StartLine, StartColumn, EndLine, EndColumn)
83 Table.Insert(self, SqlCommand)
84
85 return self.ID