IEEE.org     |     IEEE Xplore Digital Library     |     IEEE Standards     |     IEEE Spectrum     |     More Sites

Verified Commit 0a4d5e4c authored by Emi Simpson's avatar Emi Simpson
Browse files

[new arch] Doc query driver

parent 44453071
Pipeline #893 passed with stage
in 1 minute and 5 seconds
......@@ -11,6 +11,13 @@ E = TypeVar('E')
# IMPURE
def drive_query_to_end(c: Cursor, query: Query[T, E]) -> Finished[T] | Error[E]:
"""
Completely evaluate a query with regards to a real database
The output of this method will always be a final :class:`Finished` or :class:`Error`,
as produced by the query. Any :class:`Unfinished` queries will be executed themselves
until a final query is produced.
"""
while True:
query_request = query.get_query()
if len(query_request.query) == 0:
......@@ -40,8 +47,14 @@ CODES: Mapping[int, SqlErrorCode] = {
ER.CANNOT_ADD_FOREIGN: SqlErrorCode.CANNOT_ADD_FOREIGN,
ER.BAD_NULL_ERROR: SqlErrorCode.BAD_NULL_ERROR,
}
"""
A mapping of real SQL error codes to our internal error codes
"""
def convert_integrity_error(e: IntegrityError) -> SqlIntegrityError:
"""
Given a real SQL integrity error, convert it to our internal representation
"""
code_num = e.args[0]
try:
code = CODES[code_num]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment