This repository has been archived by the owner on Dec 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
/
sqlite3.py
190 lines (143 loc) · 5 KB
/
sqlite3.py
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
"""Skeleton for 'sqlite3' stdlib module."""
import sqlite3
def connect(database, timeout=5.0, detect_types=0, isolation_level=None,
check_same_thread=False, factory=None, cached_statements=100):
"""Opens a connection to the SQLite database file database.
:type database: bytes | unicode
:type timeout: float
:type detect_types: int
:type isolation_level: string | None
:type check_same_thread: bool
:type factory: (() -> sqlite3.Connection) | None
:rtype: sqlite3.Connection
"""
return sqlite3.Connection()
def register_converter(typename, callable):
"""Registers a callable to convert a bytestring from the database into a
custom Python type.
:type typename: string
:type callable: (bytes) -> unknown
:rtype: None
"""
pass
def register_adapter(type, callable):
"""Registers a callable to convert the custom Python type type into one of
SQLite's supported types.
:type type: type
:type callable: (unknown) -> unknown
:rtype: None
"""
pass
def complete_statement(sql):
"""Returns True if the string sql contains one or more complete SQL
statements terminated by semicolons.
:type sql: string
:rtype: bool
"""
return False
def enable_callback_tracebacks(flag):
"""By default you will not get any tracebacks in user-defined functions,
aggregates, converters, authorizer callbacks etc.
:type flag: bool
:rtype: None
"""
pass
class Connection(object):
"""A SQLite database connection."""
def cursor(self, cursorClass=None):
"""
:type cursorClass: type | None
:rtype: sqlite3.Cursor
"""
return sqlite3.Cursor()
def execute(self, sql, parameters=()):
"""This is a nonstandard shortcut that creates an intermediate cursor
object by calling the cursor method, then calls the cursor's execute
method with the parameters given.
:type sql: string
:type parameters: collections.Iterable
:rtype: sqlite3.Cursor
"""
pass
def executemany(self, sql, seq_of_parameters=()):
"""This is a nonstandard shortcut that creates an intermediate cursor
object by calling the cursor method, then calls the cursor's
executemany method with the parameters given.
:type sql: string
:type seq_of_parameters: collections.Iterable[collections.Iterable]
:rtype: sqlite3.Cursor
"""
pass
def executescript(self, sql_script):
"""This is a nonstandard shortcut that creates an intermediate cursor
object by calling the cursor method, then calls the cursor's
executescript method with the parameters given.
:type sql_script: bytes | unicode
:rtype: sqlite3.Cursor
"""
pass
def create_function(self, name, num_params, func):
"""Creates a user-defined function that you can later use from within
SQL statements under the function name name.
:type name: string
:type num_params: int
:type func: collections.Callable
:rtype: None
"""
pass
def create_aggregate(self, name, num_params, aggregate_class):
"""Creates a user-defined aggregate function.
:type name: string
:type num_params: int
:type aggregate_class: type
:rtype: None
"""
pass
def create_collation(self, name, callable):
"""Creates a collation with the specified name and callable.
:type name: string
:type callable: collections.Callable
:rtype: None
"""
pass
class Cursor(object):
"""A SQLite database cursor."""
def execute(self, sql, parameters=()):
"""Executes an SQL statement.
:type sql: string
:type parameters: collections.Iterable
:rtype: sqlite3.Cursor
"""
pass
def executemany(self, sql, seq_of_parameters=()):
"""Executes an SQL command against all parameter sequences or mappings
found in the sequence.
:type sql: string
:type seq_of_parameters: collections.Iterable[collections.Iterable]
:rtype: sqlite3.Cursor
"""
pass
def executescript(self, sql_script):
"""This is a nonstandard convenience method for executing multiple SQL
statements at once.
:type sql_script: bytes | unicode
:rtype: sqlite3.Cursor
"""
pass
def fetchone(self):
"""Fetches the next row of a query result set, returning a single
sequence, or None when no more data is available.
:rtype: tuple | None
"""
pass
def fetchmany(self, size=-1):
"""Fetches the next set of rows of a query result, returning a list.
:type size: numbers.Integral
:rtype: list[tuple]
"""
return []
def fetchall(self):
"""Fetches all (remaining) rows of a query result, returning a list.
:rtype: list[tuple]
"""
return []