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