pyP2Monitor
1.0.0
Monitor a P2 furnace activity reading data on serial port
|
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. |
Used to handle the Sqlite database connection.
Definition at line 33 of file p2dbstore.py.
def __init__ | ( | self, | |
filename = "p2.db" |
|||
) |
Create the Database object.
filename | The Sqlite file name |
Definition at line 41 of file p2dbstore.py.
def getData | ( | self, | |
dateMin = 0 , |
|||
dateMax = 0 |
|||
) |
Retrieve data from database.
dateMin | is the smaller data's timestamp returned |
dateMax | is the higher data's timestamp returned (0 or less mean no limit) |
Definition at line 97 of file p2dbstore.py.
Referenced by P2Msg.getRaw().
def getFirst | ( | self, | |
oldest = True |
|||
) |
Retrieve the oldest date 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
Definition at line 156 of file p2dbstore.py.
def insert | ( | self, | |
timestamp, | |||
datas | |||
) |
Insert datas into database.
timestamp | The data's timestamp |
datas | The data to store |
Definition at line 68 of file p2dbstore.py.
References P2DbStore.insertBuff.