Beispiel #1
0
 def __setitem__(self, index, value):
     if index < 0:
         sql = self.__set_element_from_back
     else:
         sql = self.__set_element_from_front
     cursor = self.conn.execute(sql, 
                                (index, to_db(value, 
                                              self.pickle_protocol)))
Beispiel #2
0
 def __get_helper(self, key):
     cursor = self.conn.execute(self.__get_STMT, (to_db(key),))
     return cursor.fetchone()
Beispiel #3
0
 def __delitem__(self, key):
     result = self.__get_helper(key)
     if result is None:
         raise KeyError(key)
     self.conn.execute(self.__delete_STMT, (to_db(key),))
     self.conn.commit()
Beispiel #4
0
 def __setitem__(self, key, value):
     self.conn.execute(self.__set_STMT, (to_db(key), to_db(value)))
     self.conn.commit()
Beispiel #5
0
 def appendleft(self, value):
     self.__decrement_front_finger()
     self.__set_helper(self.__set_element_from_front, 
                       0, to_db(value, self.pickle_protocol))
     self.conn.commit()
Beispiel #6
0
 def append(self, value):
     self.__set_helper(self.__set_element_from_back, 
                       0, to_db(value, self.pickle_protocol))
     self.__increment_back_finger()
     self.conn.commit()