updated database
authorMax Usachev <maxusachev@gmail.com>
Mon, 14 Jun 2010 12:04:16 +0000 (15:04 +0300)
committerMax Usachev <maxusachev@gmail.com>
Mon, 14 Jun 2010 12:04:16 +0000 (15:04 +0300)
database/SQLite.py

index 01870d7..7940f4b 100644 (file)
@@ -93,9 +93,6 @@ class SQLite:
 
         execute = self.conn.execute
 
-        if not 'uid' in entry or not 'o' in entry:
-            return
-
         try:
             _id = execute("SELECT MAX(id) FROM data").fetchone()[0] \
                 + 1
@@ -114,7 +111,8 @@ class SQLite:
 
             # update DATA table
             for value in values:
-                execute("INSERT INTO data values(?,?,?)", (_id, field_id, value))
+                execute("INSERT INTO data values(?,?,?)", \
+                    (_id, field_id, value))
 
         # update STRUCT table
         name = entry[TOPLEVEL_FIELD][0]
@@ -193,23 +191,3 @@ class SQLite:
             return {}
         else:
             return dict(sql_res.fetchall())
-
-    def get_all_entries(self):
-        """Returns list of all entries."""
-
-        ids = [item[0] for item in self.conn.execute("""SELECT DISTINCT id \
-            FROM data""").fetchall()]
-        return [self.get_entry_by_id(_id) for _id in ids]
-
-
-
-
-if __name__ == "__main__":
-    db = SQLite('/tmp/')
-    #db.update_field('test')
-    #print db.get_field_id_by_name('fax')
-    #print db.get_entry_by_id(1)
-    #print db.get_all_entries()
-    db.close()
-
-