-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathstatement.py
More file actions
56 lines (41 loc) · 1.57 KB
/
statement.py
File metadata and controls
56 lines (41 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""NuoDB Python driver SQL statement.
(C) Copyright 2013-2023 Dassault Systemes SE. All Rights Reserved.
This software is licensed under a BSD 3-Clause License.
See the LICENSE file provided with this software.
"""
try:
from typing import Any, List, Optional # pylint: disable=unused-import
except ImportError:
pass
class Statement(object):
"""A SQL statement."""
def __init__(self, handle):
# type: (int) -> None
"""Create a statement.
:param handle: Handle of the connection.
"""
self.handle = handle
class PreparedStatement(Statement):
"""A SQL prepared statement."""
def __init__(self, handle, parameter_count):
# type: (int, int) -> None
"""Create a prepared statement.
:param handle: Handle of the connection.
:param parameter_count: Number of parameters needed.
"""
super(PreparedStatement, self).__init__(handle)
self.parameter_count = parameter_count
self.description = None # type: Optional[List[List[Any]]]
self.query = None # type: Optional[str]
class ExecutionResult(object):
"""Result of a statement execution."""
def __init__(self, statement, result, row_count):
# type: (Statement, int, int) -> None
"""Create the result of a statement execution.
:param statement: Statement that was executed.
:param result: Result of execution.
:param row_count: Number of rows in the result.
"""
self.result = result
self.row_count = row_count
self.statement = statement