Antano » Antano Server API » DBManager
Antano® will be released very soon. This is an announcement text

Contents

Search

DBManager

class server.DBManager

Bases: object

DBManager resolves all sql and database request and holds the _con and _cur connection

Methods Summary

db_query(_columns, _table, _condition[, …]) Executes a simple db query and creates a new connection and cursor in the database
execute_query(_sql) User defined query to execute in db
get_client_connections(_ids[, _allow_unsafe]) Gets all clients with given ids out of the db
init_database(_server_settings, _server_id) Inits our database with given server settings It will create a cursor and a con if it is none
query(_columns, _table, _condition[, _cur_type]) Executes a simple db query and creates a new connection and cursor in the database

Methods Documentation

static db_query(_columns, _table, _condition, _cur_type=None)

Executes a simple db query and creates a new connection and cursor in the database

Parameters:
  • {String} -- current columns to select (_columns) –
  • {String} -- table from db (_table) –
  • {String} -- condition (_condition) –
Keyword Arguments:
 

{cursor_factory} -- current cursor_type (default (_cur_type) – {None})

Raises:

e – DataBase error

Returns:

Array – current array from database

static execute_query(_sql)

User defined query to execute in db

Parameters:{String} -- complete query for sql (_sql) –
get_client_connections(_ids, _allow_unsafe=False)

Gets all clients with given ids out of the db

Parameters:
  • {list[int]} -- array of ids (_ids) –
  • {bool} -- wether udp and unsafed protocolls allowed (_allow_unsafe) –
Returns:

[]} – sorted response in a dict

Return type:

_dict dict{int

init_database(_server_settings, _server_id)

Inits our database with given server settings It will create a cursor and a con if it is none

Parameters:
  • {ServerSettings obj} -- current server settings (_server_settings) –
  • {Int} -- current ServerID (_server_id) –
Raises:

e – DatabaseError

query(_columns, _table, _condition, _cur_type=None)

Executes a simple db query and creates a new connection and cursor in the database

Parameters:
  • {String} -- current columns to select (_columns) –
  • {String} -- table from db (_table) –
  • {String} -- condition (_condition) –
Keyword Arguments:
 

{cursor_factory} -- current cursor_type (default (_cur_type) – {None})

Raises:

e – DataBase error

Returns:

Array – current array from database

Last update: 10/08/2020 3:43 a.m. (CET)