Exemplo n.º 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)))
Exemplo n.º 2
0
 def __get_helper(self, key):
     cursor = self.conn.execute(self.__get_STMT, (to_db(key),))
     return cursor.fetchone()
Exemplo n.º 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()
Exemplo n.º 4
0
 def __setitem__(self, key, value):
     self.conn.execute(self.__set_STMT, (to_db(key), to_db(value)))
     self.conn.commit()
Exemplo n.º 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()
Exemplo n.º 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()