.oO SearXNG Developer Documentation Oo.
|
Public Member Functions | |
__init__ (self, str db_url) | |
bool | init (self, sqlite3.Connection conn) |
t.Any | __call__ (self, str name, t.Any default=None) |
set (self, str name, str|int value) | |
int | delete (self, str name) |
row (self, str name, t.Any default=None) | |
int | m_time (self, str name, int default=0) |
create_schema (self, sqlite3.Connection conn) | |
str | __str__ (self) |
Public Member Functions inherited from searx.sqlitedb.SQLiteAppl | |
__init__ (self, str db_url) | |
sqlite3.Connection | connect (self) |
register_functions (self, sqlite3.Connection conn) | |
sqlite3.Connection | DB (self) |
Static Public Attributes | |
str | DDL_PROPERTIES |
str | SQL_GET = "SELECT value FROM properties WHERE name = ?" |
str | SQL_M_TIME = "SELECT m_time FROM properties WHERE name = ?" |
tuple | SQL_SET |
str | SQL_DELETE = "DELETE FROM properties WHERE name = ?" |
tuple | SQL_TABLE_EXISTS |
Static Public Attributes inherited from searx.sqlitedb.SQLiteAppl | |
dict | DDL_CREATE_TABLES = {} |
int | DB_SCHEMA = 1 |
dict | SQLITE_THREADING_MODE |
str | SQLITE_JOURNAL_MODE = "WAL" |
dict | SQLITE_CONNECT_ARGS |
Additional Inherited Members | |
Public Attributes inherited from searx.sqlitedb.SQLiteAppl | |
str | db_url = db_url |
SQLiteProperties | properties = SQLiteProperties(db_url) |
Protected Member Functions inherited from searx.sqlitedb.SQLiteAppl | |
_compatibility (self) | |
sqlite3.Connection | _connect (self) |
Protected Attributes inherited from searx.sqlitedb.SQLiteAppl | |
bool | _init_done = False |
sqlite3.Connection|None | _DB = None |
Simple class to manage properties of a DB application in the DB. The object has its own DB connection and transaction area. .. code:: sql CREATE TABLE IF NOT EXISTS properties ( name TEXT, value TEXT, m_time INTEGER DEFAULT (strftime('%s', 'now')), PRIMARY KEY (name))
Definition at line 319 of file sqlitedb.py.
searx.sqlitedb.SQLiteProperties.__init__ | ( | self, | |
str | db_url ) |
Definition at line 359 of file sqlitedb.py.
t.Any searx.sqlitedb.SQLiteProperties.__call__ | ( | self, | |
str | name, | ||
t.Any | default = None ) |
Returns the value of the property ``name`` or ``default`` if property not exists in DB.
Definition at line 377 of file sqlitedb.py.
References searx.cache.ExpireCacheSQLite.DB, DB, and SQL_GET.
str searx.sqlitedb.SQLiteProperties.__str__ | ( | self | ) |
Definition at line 423 of file sqlitedb.py.
References searx.cache.ExpireCacheSQLite.DB, and DB.
searx.sqlitedb.SQLiteProperties.create_schema | ( | self, | |
sqlite3.Connection | conn ) |
Reimplemented from searx.sqlitedb.SQLiteAppl.
Definition at line 419 of file sqlitedb.py.
References DDL_PROPERTIES.
int searx.sqlitedb.SQLiteProperties.delete | ( | self, | |
str | name ) |
Delete of property ``name`` from DB.
Definition at line 393 of file sqlitedb.py.
References searx.cache.ExpireCacheSQLite.DB, DB, and SQL_DELETE.
bool searx.sqlitedb.SQLiteProperties.init | ( | self, | |
sqlite3.Connection | conn ) |
Initializes DB schema of the properties in the DB.
Reimplemented from searx.sqlitedb.SQLiteAppl.
Definition at line 365 of file sqlitedb.py.
References searx.sqlitedb.SQLiteAppl._init_done, searx.sqlitedb.SQLiteAppl.create_schema(), searx.cache.ExpireCacheCfg.db_url, searx.favicons.cache.FaviconCacheConfig.db_url, searx.sqlitedb.SQLiteAppl.db_url, and SQL_TABLE_EXISTS.
int searx.sqlitedb.SQLiteProperties.m_time | ( | self, | |
str | name, | ||
int | default = 0 ) |
Last modification time of this property.
Definition at line 411 of file sqlitedb.py.
References searx.cache.ExpireCacheSQLite.DB, DB, and SQL_M_TIME.
searx.sqlitedb.SQLiteProperties.row | ( | self, | |
str | name, | ||
t.Any | default = None ) |
Returns the DB row of property ``name`` or ``default`` if property not exists in DB.
Definition at line 399 of file sqlitedb.py.
References searx.cache.ExpireCacheSQLite.DB, and DB.
searx.sqlitedb.SQLiteProperties.set | ( | self, | |
str | name, | ||
str | int | value ) |
Set ``value`` of property ``name`` in DB. If property already exists, update the ``m_time`` (and the value).
Definition at line 386 of file sqlitedb.py.
|
static |
Definition at line 335 of file sqlitedb.py.
Referenced by create_schema().
|
static |
Definition at line 351 of file sqlitedb.py.
Referenced by delete().
|
static |
Definition at line 344 of file sqlitedb.py.
Referenced by __call__().
|
static |
Definition at line 345 of file sqlitedb.py.
Referenced by m_time().
|
static |
Definition at line 346 of file sqlitedb.py.
|
static |
Definition at line 352 of file sqlitedb.py.
Referenced by init().