pyP2Monitor  1.0.0
Monitor a P2 furnace activity reading data on serial port
 All Data Structures Namespaces Functions Variables Groups Pages
Public Member Functions | Data Fields | Static Public Attributes
P2DbStore Class Reference

Used to handle the Sqlite database connection. More...

Public Member Functions

def __init__
 Create the Database object.
def insert
 Insert datas into database.
def getData
 Retrieve data from database.
def getFirst
 Retrieve the oldest date in the db.
def getLastData
 Retrieve the last (newest) data in db.
def __del__
 P2DbStore destructor.

Data Fields

 conn
 The database connection self.conn = sqlite3.connect(filename, 5)
 c
 The database cursor.
 insertBuff
 A buffer used to store valued that failed to be inserted previously.

Static Public Attributes

int INSERTBUFFSZ = 60
 Maximum insery buffer size.

Detailed Description

Used to handle the Sqlite database connection.

Definition at line 33 of file p2dbstore.py.

Constructor & Destructor Documentation

def __init__ (   self,
  filename = "p2.db" 
)

Create the Database object.

Parameters
filenameThe Sqlite file name

Definition at line 41 of file p2dbstore.py.

Member Function Documentation

def getData (   self,
  dateMin = 0,
  dateMax = 0 
)

Retrieve data from database.

Parameters
dateMinis the smaller data's timestamp returned
dateMaxis the higher data's timestamp returned (0 or less mean no limit)
Returns
An array of selected datas

Definition at line 97 of file p2dbstore.py.

Referenced by P2Msg.getRaw().

def getFirst (   self,
  oldest = True 
)

Retrieve the oldest date in the db.

Returns
The smallest timestamp in the db

Definition at line 135 of file p2dbstore.py.

def getLastData (   self)

Retrieve the last (newest) data in db.

Can be a relatively long query

Returns
The bigger timestamp

Definition at line 156 of file p2dbstore.py.

def insert (   self,
  timestamp,
  datas 
)

Insert datas into database.

Parameters
timestampThe data's timestamp
datasThe data to store

Definition at line 68 of file p2dbstore.py.

References P2DbStore.insertBuff.


The documentation for this class was generated from the following file: