*Code cleanup in livestatus servicesbygroup
[shinken.git] / shinken / db_sqlite.py
blobe560735ade32738fe64856e9c2925b3c10ca29cf
1 #!/usr/bin/env python
2 #Copyright (C) 2009-2010 :
3 # Gabes Jean, naparuba@gmail.com
4 # Gerhard Lausser, Gerhard.Lausser@consol.de
6 #This file is part of Shinken.
8 #Shinken is free software: you can redistribute it and/or modify
9 #it under the terms of the GNU Affero General Public License as published by
10 #the Free Software Foundation, either version 3 of the License, or
11 #(at your option) any later version.
13 #Shinken is distributed in the hope that it will be useful,
14 #but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 #GNU Affero General Public License for more details.
18 #You should have received a copy of the GNU Affero General Public License
19 #along with Shinken. If not, see <http://www.gnu.org/licenses/>.
22 #DBSqlite is a sqlite access database class
23 from db import DB
24 import sqlite3
27 class DBSqlite(DB):
28 def __init__(self, db_path, table_prefix = ''):
29 self.table_prefix = table_prefix
30 self.db_path = db_path
33 #Create the database connexion
34 def connect_database(self):
35 self.db = sqlite3.connect(self.db_path)
36 self.db_cursor = self.db.cursor ()
39 #Just run the query
40 def execute_query(self, query):
41 print "[SqliteDB]I run query", query, "\n"
42 self.db_cursor.execute(query)
43 self.db.commit ()