Package tlib :: Package base :: Module MysqlConnector :: Class MysqlConnector |
[hide private]
[frames] | no frames]

# Class MysqlConnector

source code

    object --+
             |
            MysqlConnector

Connects to MySQL DB, executes queries Autocommit is disabled by default, commit is done with commit function Warnings are turned into exceptions

Instance Methods | [hide private]
__init__(self, config_data) Initialize DB connection. | source code
get_autocommit_status(self, var_type=`'``local``'`) Returns status of autocommit LOCAL/GLOBAL/SESSION variables (local by default) :return: tuple(dict) i.e. | source code
select_query(self, query, fetch=`'``all``'`) Send/execute queries :param: str MySQL query :param: str 'one'/'all' Rows to be fetched :return: fetch = one dictionary i.e. | source code
update_query(self, query) Sends query to DB. | source code
delete_query(self, query) to be updated: don't have permission to delete on current working DB | source code
commit(self) | source code
rollback(self) | source code
close_cursor(self) | source code
close_db(self) | source code
__del__(self) | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, config_data) (Constructor) | source code
Initialize DB connection. Turning warning into exceptions Overrides: object.__init__

### get_autocommit_status(self, var_type=`'``local``'`) | source code
Returns status of autocommit LOCAL/GLOBAL/SESSION variables (local by default) :return: tuple(dict) i.e. ({'Value': 'OFF', 'Variable_name': 'autocommit'},)

### select_query(self, query, fetch=`'``all``'`) | source code
Send/execute queries :param: str MySQL query :param: str 'one'/'all' Rows to be fetched :return: fetch = one dictionary i.e. {row_1} :return: fetch != one tuple with arguments dictionaries, each dictionary is a row i.e. ({row_first}, {row_second}, ... ,{row_last})

### update_query(self, query) | source code
Sends query to DB. :param: str query :return: int Nr of rows updated (in case of updating with same value, query is successful but nr of rows updated = 0