]>
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, 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 import Common
.EdkLogger
as EdkLogger
18 from Common
.String
import ConvertToSqlString
19 from Table
import Table
23 # This class defined a table used for Identifier
25 # @param object: Inherited from object class
28 class TableIdentifier(Table
):
29 def __init__(self
, Cursor
):
30 Table
.__init
__(self
, Cursor
)
31 self
.Table
= 'Identifier'
35 # Create table Identifier
37 # @param ID: ID of a Identifier
38 # @param Modifier: Modifier of a Identifier
39 # @param Type: Type of a Identifier
40 # @param Name: Name of a Identifier
41 # @param Value: Value of a Identifier
42 # @param Model: Model of a Identifier
43 # @param BelongsToFile: The Identifier belongs to which file
44 # @param BelongsToFunction: The Identifier belongs to which function
45 # @param StartLine: StartLine of a Identifier
46 # @param StartColumn: StartColumn of a Identifier
47 # @param EndLine: EndLine of a Identifier
48 # @param EndColumn: EndColumn of a Identifier
51 SqlCommand
= """create table IF NOT EXISTS %s(ID INTEGER PRIMARY KEY,
54 Name VARCHAR NOT NULL,
55 Value VARCHAR NOT NULL,
56 Model INTEGER NOT NULL,
57 BelongsToFile SINGLE NOT NULL,
58 BelongsToFunction SINGLE DEFAULT -1,
59 StartLine INTEGER NOT NULL,
60 StartColumn INTEGER NOT NULL,
61 EndLine INTEGER NOT NULL,
62 EndColumn INTEGER NOT NULL
64 Table
.Create(self
, SqlCommand
)
68 # Insert a record into table Identifier
70 # @param ID: ID of a Identifier
71 # @param Modifier: Modifier of a Identifier
72 # @param Type: Type of a Identifier
73 # @param Name: Name of a Identifier
74 # @param Value: Value of a Identifier
75 # @param Model: Model of a Identifier
76 # @param BelongsToFile: The Identifier belongs to which file
77 # @param BelongsToFunction: The Identifier belongs to which function
78 # @param StartLine: StartLine of a Identifier
79 # @param StartColumn: StartColumn of a Identifier
80 # @param EndLine: EndLine of a Identifier
81 # @param EndColumn: EndColumn of a Identifier
83 def Insert(self
, Modifier
, Type
, Name
, Value
, Model
, BelongsToFile
, BelongsToFunction
, StartLine
, StartColumn
, EndLine
, EndColumn
):
85 (Modifier
, Type
, Name
, Value
) = ConvertToSqlString((Modifier
, Type
, Name
, Value
))
86 SqlCommand
= """insert into %s values(%s, '%s', '%s', '%s', '%s', %s, %s, %s, %s, %s, %s, %s)""" \
87 % (self
.Table
, self
.ID
, Modifier
, Type
, Name
, Value
, Model
, BelongsToFile
, BelongsToFunction
, StartLine
, StartColumn
, EndLine
, EndColumn
)
88 Table
.Insert(self
, SqlCommand
)