]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Table/TableIdentifier.py
2 # This file is used to create/update/query/erase table for Identifiers
4 # Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
5 # SPDX-License-Identifier: BSD-2-Clause-Patent
11 from __future__
import absolute_import
12 import Common
.EdkLogger
as EdkLogger
13 from Common
.StringUtils
import ConvertToSqlString
14 from Table
.Table
import Table
18 # This class defined a table used for Identifier
20 # @param object: Inherited from object class
23 class TableIdentifier(Table
):
24 def __init__(self
, Cursor
):
25 Table
.__init
__(self
, Cursor
)
26 self
.Table
= 'Identifier'
30 # Create table Identifier
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
46 SqlCommand
= """create table IF NOT EXISTS %s(ID INTEGER PRIMARY KEY,
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
59 Table
.Create(self
, SqlCommand
)
63 # Insert a record into table Identifier
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
78 def Insert(self
, Modifier
, Type
, Name
, Value
, Model
, BelongsToFile
, BelongsToFunction
, StartLine
, StartColumn
, EndLine
, EndColumn
):
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
)