.oO SearXNG Developer Documentation Oo.
|
Public Member Functions | |
__init__ (self, str db_url) | |
bool | init (self, sqlite3.Connection conn) |
__call__ (self, str name, default=None) | |
set (self, str name, str|int value) | |
int | delete (self, str name) |
row (self, str name, default=None) | |
int | m_time (self, str name, int default=0) |
create_schema (self, conn) | |
str | __str__ (self) |
![]() | |
__init__ (self, db_url) | |
sqlite3.Connection | connect (self) |
register_functions (self, 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 |
![]() | |
dict | DDL_CREATE_TABLES = {} |
int | DB_SCHEMA = 1 |
dict | SQLITE_THREADING_MODE |
str | SQLITE_JOURNAL_MODE = "WAL" |
dict | SQLITE_CONNECT_ARGS |
Additional Inherited Members | |
![]() | |
db_url = db_url | |
properties = SQLiteProperties(db_url) | |
![]() | |
_compatibility (self) | |
sqlite3.Connection | _connect (self) |
![]() | |
bool | _init_done = False |
_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 317 of file sqlitedb.py.
searx.sqlitedb.SQLiteProperties.__init__ | ( | self, | |
str | db_url ) |
Definition at line 356 of file sqlitedb.py.
searx.sqlitedb.SQLiteProperties.__call__ | ( | self, | |
str | name, | ||
default = None ) |
Returns the value of the property ``name`` or ``default`` if property not exists in DB.
Definition at line 374 of file sqlitedb.py.
References searx.cache.ExpireCacheSQLite.DB, DB, and SQL_GET.
str searx.sqlitedb.SQLiteProperties.__str__ | ( | self | ) |
Definition at line 420 of file sqlitedb.py.
References searx.cache.ExpireCacheSQLite.DB, and DB.
searx.sqlitedb.SQLiteProperties.create_schema | ( | self, | |
conn ) |
Reimplemented from searx.sqlitedb.SQLiteAppl.
Definition at line 416 of file sqlitedb.py.
References DDL_PROPERTIES.
int searx.sqlitedb.SQLiteProperties.delete | ( | self, | |
str | name ) |
Delete of property ``name`` from DB.
Definition at line 390 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 362 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 408 of file sqlitedb.py.
References searx.cache.ExpireCacheSQLite.DB, DB, and SQL_M_TIME.
searx.sqlitedb.SQLiteProperties.row | ( | self, | |
str | name, | ||
default = None ) |
Returns the DB row of property ``name`` or ``default`` if property not exists in DB.
Definition at line 396 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 383 of file sqlitedb.py.
|
static |
Definition at line 333 of file sqlitedb.py.
Referenced by create_schema().
|
static |
Definition at line 349 of file sqlitedb.py.
Referenced by delete().
|
static |
Definition at line 342 of file sqlitedb.py.
Referenced by __call__().
|
static |
Definition at line 343 of file sqlitedb.py.
Referenced by m_time().
|
static |
Definition at line 344 of file sqlitedb.py.
|
static |
Definition at line 350 of file sqlitedb.py.
Referenced by init().