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 tuple Autocommit status i.e. | source code
query_select(self, query) Send/execute SELECT queries, returns data from DB :param: str MySQL query :return: tuple with arguments dictionaries, each dictionary is a row of DB i.e. | source code
query_execute(self, query) Sends query to DB. | source code
commit(self) Commits all changes, returns Exception in case of failure | source code
rollback(self) Rolls back all commits, returns exception in case of failure | source code
close_cursor(self) Close cursor. | source code
close_db(self) Close DB connection. | 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 tuple Autocommit status i.e. ({'Value': 'ON', 'Variable_name':'autocommit'},)

### query_select(self, query) | source code
Send/execute SELECT queries, returns data from DB :param: str MySQL query :return: tuple with arguments dictionaries, each dictionary is a row of DB i.e. ({row_first}, {row_second}, ... ,{row_last})

### query_execute(self, query) | source code
Sends query to DB. Can be DELETE, UPDATE :param: str query :return: dict {DictCursor}

### close_cursor(self) | source code
Close cursor. Connection to DB is still open, new cursor can be created

### close_db(self) | source code
Close DB connection. All uncommitted changes are lost