Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-tools by
BaseDBAccess Class Reference
Public Member Functions | |
def | get_hostname |
def | get_db_type |
def | detect_database |
def | parse_db_connection_string |
def | is_connected |
def | connect |
def | connect_url |
def | reconnect |
def | disconnect |
def | escape_string |
def | select_all |
def | insert |
def | get_next_build_id |
def | get_table_entry_pk |
def | update_table_entry |
def | update_build_id_info |
def | insert_test_entry |
Detailed Description
Class used to connect with test database and store test results
Definition at line 24 of file test_db.py.
Member Function Documentation
def connect | ( | self, | |
host, | |||
user, | |||
passwd, | |||
db | |||
) |
Connects to DB and returns DB object
Definition at line 99 of file test_db.py.
def connect_url | ( | self, | |
db_url | |||
) |
Connects to database using db_url (database url parsing), store host, username, password, db_name
Definition at line 104 of file test_db.py.
def detect_database | ( | self, | |
verbose = False |
|||
) |
detect database and return VERION data structure or string (verbose=True)
Definition at line 72 of file test_db.py.
def disconnect | ( | self ) |
Close DB connection
Definition at line 116 of file test_db.py.
def escape_string | ( | self, | |
str | |||
) |
Escapes string so it can be put in SQL query between quotes
Definition at line 121 of file test_db.py.
def get_db_type | ( | self ) |
Returns database type. E.g. 'mysql', 'sqlLite' etc.
Definition at line 67 of file test_db.py.
def get_hostname | ( | self ) |
Useful when creating build_id in database Function returns (hostname, uname) which can be used as (build_id_name, build_id_desc)
Definition at line 55 of file test_db.py.
def get_next_build_id | ( | self, | |
name, | |||
desc = '' , |
|||
location = '' , |
|||
type = None , |
|||
status = None |
|||
) |
Insert new build_id (DB unique build like ID number to send all test results)
Definition at line 136 of file test_db.py.
def get_table_entry_pk | ( | self, | |
table, | |||
column, | |||
value, | |||
update_db = True |
|||
) |
Checks for entries in tables with two columns (<TABLE_NAME>_pk, <column>) If update_db is True updates table entry if value in specified column doesn't exist
Definition at line 141 of file test_db.py.
def insert | ( | self, | |
query, | |||
commit = True |
|||
) |
Execute INSERT query, define if you want to commit
Definition at line 131 of file test_db.py.
def insert_test_entry | ( | self, | |
build_id, | |||
target, | |||
toolchain, | |||
test_type, | |||
test_id, | |||
test_result, | |||
test_time, | |||
test_timeout, | |||
test_loop, | |||
test_extra = '' |
|||
) |
Inserts test result entry to database. All checks regarding existing toolchain names in DB are performed. If some data is missing DB will be updated
Definition at line 160 of file test_db.py.
def is_connected | ( | self ) |
Returns True if we are connected to database
Definition at line 94 of file test_db.py.
def parse_db_connection_string | ( | self, | |
str | |||
) |
Parsing SQL DB connection string. String should contain: - DB Name, user name, password, URL (DB host), name Function should return tuple with parsed (db_type, username, password, host, db_name) or None if error (db_type, username, password, host, db_name) = self.parse_db_connection_string(db_url) E.g. connection string: 'mysql://username:password@127.0.0.1/db_name'
Definition at line 77 of file test_db.py.
def reconnect | ( | self ) |
Reconnects to DB and returns DB object using stored host name, database name and credentials (user name and password)
Definition at line 110 of file test_db.py.
def select_all | ( | self, | |
query | |||
) |
Execute SELECT query and get all results
Definition at line 126 of file test_db.py.
def update_build_id_info | ( | self, | |
build_id, | |||
kw | |||
) |
Update additional data inside build_id table Examples: db.update_build_is(build_id, _status_fk=self.BUILD_ID_STATUS_COMPLETED, _shuffle_seed=0.0123456789):
Definition at line 153 of file test_db.py.
def update_table_entry | ( | self, | |
table, | |||
column, | |||
value | |||
) |
Updates table entry if value in specified column doesn't exist Locks table to perform atomic read + update
Definition at line 147 of file test_db.py.
Generated on Thu Jun 15 2023 14:55:00 by
