Public Member Functions | |
def | __init__ |
Set the attributes of the class to None. | |
def | openCon |
Create a connection to the HdLorean database, if the database does not exist create a new one. | |
def | createTables |
Create the tables needed to the HdLorean aplication. | |
def | closeCon |
Close connection to the database. | |
def | insertJournal |
Inserts in the journal table a new row with the values of the parameters. | |
def | select |
Extracts from the table the information requested. | |
def | update |
Create a update query from the input data. | |
def | delete |
Create a delete query from the input data. | |
Private Attributes | |
__sqlite3_conn | |
Keeps de conection to the database. | |
__sqlite3_cur | |
Keeps the cursor. |
This class implements all the functions needed to control the database of HdLorean
def DataBase.DataBase.__init__ | ( | self | ) |
Set the attributes of the class to None.
def DataBase.DataBase.openCon | ( | self | ) |
Create a connection to the HdLorean database, if the database does not exist create a new one.
def DataBase.DataBase.createTables | ( | self | ) |
Create the tables needed to the HdLorean aplication.
Standarderror | if the table exists in de database. |
def DataBase.DataBase.closeCon | ( | self | ) |
Close connection to the database.
def DataBase.DataBase.insertJournal | ( | self, | ||
timestamp, | ||||
chtype, | ||||
init, | ||||
final, | ||||
wrote | ||||
) |
Inserts in the journal table a new row with the values of the parameters.
timestamp | value for the field timestamp of the journal table.. | |
chtype | value for the field chtype of the journal table. | |
init | value for the field initpath of the journal table. | |
final | value for the field finalpath of the journal table. | |
wrote | value for the field wrote of the journal table. |
StandardError | if the row is in the table (Integrity error) or if the query is wrong (DatabaseError) |
def DataBase.DataBase.select | ( | self, | ||
table, | ||||
listcolumns, | ||||
listcond = [] , |
||||
listord = [] , |
||||
listgroup = [] , |
||||
listhav = [] | ||||
) |
Extracts from the table the information requested.
Create a select query from the input data and returns the results in an array.
table | table where de selec query is executed. | |
listcolums | column list to draw from the table. Example: ['timestamp','wrote'] | |
listcond | list of conditions. Example: ['timestamp=02.03.07','and','wrote=0'] | |
listord | list of orders. Example: ['timestamp ASC','wrote'] | |
listgroup | list of groups. Example: ['wrote'] | |
listhav | list of having. |
StandardError | if the sql query is wrong (DatabaseError) |
def DataBase.DataBase.update | ( | self, | ||
table, | ||||
mcolumn, | ||||
listcond | ||||
) |
Create a update query from the input data.
table | table where update is done. | |
column | column of the table to update. Example: timestamp. | |
listcond | List of conditions for upgrade. Example: ['timestamp=02.03.07','and','wrote=0'] |
StandardError | if the row is in the table (Integrity error) or if the query is wrong (DatabaseError) |
def DataBase.DataBase.delete | ( | self, | ||
table, | ||||
listcond | ||||
) |
Create a delete query from the input data.
table | table where row is deleted. | |
listcond | List of conditions for delete. Example: ['timestamp=02.03.07','and','wrote=0'] |
StandardError | if the query is wrong (DatabaseError) |
DataBase.DataBase.__sqlite3_conn [private] |
Keeps de conection to the database.
DataBase.DataBase.__sqlite3_cur [private] |
Keeps the cursor.