DataBase.DataBase Class Reference

Database interfaze class. More...

List of all members.

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.


Detailed Description

Database interfaze class.

This class implements all the functions needed to control the database of HdLorean


Member Function Documentation

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.

Exceptions:
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.

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.
Exceptions:
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.

Parameters:
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.
Returns:
An array with the selected tuples
Exceptions:
StandardError if the sql query is wrong (DatabaseError)

def DataBase.DataBase.update (   self,
  table,
  mcolumn,
  listcond 
)

Create a update query from the input data.

Parameters:
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']
Exceptions:
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.

Parameters:
table table where row is deleted.
listcond List of conditions for delete. Example: ['timestamp=02.03.07','and','wrote=0']
Exceptions:
StandardError if the query is wrong (DatabaseError)


Member Data Documentation

DataBase.DataBase.__sqlite3_conn [private]

Keeps de conection to the database.

DataBase.DataBase.__sqlite3_cur [private]

Keeps the cursor.


Generated on Wed Dec 19 19:25:04 2007 for HdLorean by  doxygen 1.5.4