Skip to content

vtf txb _buffercomponents _sql

srccircumflex edited this page Jan 6, 2023 · 3 revisions

↑ vtf-txb-_buffercomponents

_sql

The module contains helpers and advanced features in SQLite handling.

Module contents

Constants

DATABASE_FILES_ERROR_SUIT: _DBInitSuit = _DBInitSuit()

This context manager is used when checking whether the database file already exists.

DATABASE_TABLE_ERROR_SUIT: _DBInitSuit = _DBInitSuit()

This context manager is used when creating the database tables.

Functions

_sql.path_from_uri(uri) -> tuple[str, bool] | None

Parse the file path from a uri or return None if the input is not a uri.

Return a positive value as a tuple:
( <the file path | memory database name>, <whether memory mode is used> )

Objects

class _sql._DBInitSuit(ContextManager)

A contextmanager/suit that is applied when a database is created.

Allows to handle or ignore database errors during creation.

For example, if a database is passed during parameterization whose files and tables already exist, this will normally cause an error. If these errors are to be avoided and the database is to be accepted nevertheless, the method do_ignore can be executed over the global constants DATABASE_FILES_ERROR_SUIT and DATABASE_TABLE_ERROR_SUIT of the module beforehand.

do_ignore() -> None

Enable ignoring of all errors.

do_raise() -> None

Enable the raising of errors.

set_handler(handler) -> None

Set a custom handler for exiting.

This function is executed within the __exit__ method and receives the same parameters, the return value is also returned by __exit__.

class _sql.SQLTSCursor(Cursor)

A thread-safe SQLite Cursor object.

Used inside the buffer components _LocalHistory and _Swap as the database cursor, since the property check_same_thread is disabled in the SQLite Connection's.

Contains a RLock which is used inside the execute* methods.

__lock__: RLock


Date: 20 Dec 2022
Version: 0.1
Author: Adrian Hoefflin [srccircumflex]
Doc-Generator: "pyiStructure-RSTGenerator" <prototype>

Clone this wiki locally