]>
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 # 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 Common
.StringUtils
import ConvertToSqlString
20 from Table
.Table
import Table
24 # This class defined a table used for Identifier
26 # @param object: Inherited from object class
29 class TableIdentifier(Table
):
30 def __init__(self
, Cursor
):
31 Table
.__init
__(self
, Cursor
)
32 self
.Table
= 'Identifier'
36 # Create table Identifier
38 # @param ID: ID of a Identifier
39 # @param Modifier: Modifier of a Identifier
40 # @param Type: Type of a Identifier
41 # @param Name: Name of a Identifier
42 # @param Value: Value of a Identifier
43 # @param Model: Model of a Identifier
44 # @param BelongsToFile: The Identifier belongs to which file
45 # @param BelongsToFunction: The Identifier belongs to which function
46 # @param StartLine: StartLine of a Identifier
47 # @param StartColumn: StartColumn of a Identifier
48 # @param EndLine: EndLine of a Identifier
49 # @param EndColumn: EndColumn of a Identifier
52 SqlCommand
= """create table IF NOT EXISTS %s(ID INTEGER PRIMARY KEY,
55 Name VARCHAR NOT NULL,
56 Value 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 Identifier
71 # @param ID: ID of a Identifier
72 # @param Modifier: Modifier of a Identifier
73 # @param Type: Type of a Identifier
74 # @param Name: Name of a Identifier
75 # @param Value: Value of a Identifier
76 # @param Model: Model of a Identifier
77 # @param BelongsToFile: The Identifier belongs to which file
78 # @param BelongsToFunction: The Identifier belongs to which function
79 # @param StartLine: StartLine of a Identifier
80 # @param StartColumn: StartColumn of a Identifier
81 # @param EndLine: EndLine of a Identifier
82 # @param EndColumn: EndColumn of a Identifier
84 def Insert(self
, Modifier
, Type
, Name
, Value
, Model
, BelongsToFile
, BelongsToFunction
, StartLine
, StartColumn
, EndLine
, EndColumn
):
86 (Modifier
, Type
, Name
, Value
) = ConvertToSqlString((Modifier
, Type
, Name
, Value
))
87 SqlCommand
= """insert into %s values(%s, '%s', '%s', '%s', '%s', %s, %s, %s, %s, %s, %s, %s)""" \
88 % (self
.Table
, self
.ID
, Modifier
, Type
, Name
, Value
, Model
, BelongsToFile
, BelongsToFunction
, StartLine
, StartColumn
, EndLine
, EndColumn
)
89 Table
.Insert(self
, SqlCommand
)