Skip to content

Commit

Permalink
Show how to get a string from a result code
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerbinns committed Nov 8, 2023
1 parent 71437ab commit f157835
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apsw/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ def _iskeyword(s: str) -> bool:
return s in _keywords


def result_string(code: int) -> str:
"""Turns a result or extended result code into a string.
The appropriate mapping based on the value is used."""
if code < 256:
return apsw.mapping_result_codes.get(code, str(code))
return apsw.mapping_extended_result_codes.get(code, str(code))


class DataClassRowFactory:
"""Returns each row as a :mod:`dataclass <dataclasses>`, accessible by column name.
Expand Down

0 comments on commit f157835

Please sign in to comment.