Ejemplo n.º 1
0
 def getObject(self, key, bucket):
     if not self._bucket_exists(bucket):
         return key, None
     c = self.conn.execute("SELECT key, value from `{}` WHERE key=?"
                           .format(hash(bucket)), (key,))
     row = c.fetchone()
     if row:
         k, v = row
         return (k, dejsonify(decompress(v)))
     else:
         return key, None
Ejemplo n.º 2
0
 def getObject(self, key, bucket):
     if not self._bucket_exists(bucket):
         return key, None
     c = self.conn.execute("SELECT key, value from `{}` WHERE key=?"
                           .format(hash(bucket)), (key,))
     row = c.fetchone()
     if row:
         k, v = row
         return (k, dejsonify(decompress(v).decode('utf-8')))
     else:
         return key, None
Ejemplo n.º 3
0
 def getAllObjects(self, bucket):
     if not self._bucket_exists(bucket):
         return
     for k, v in self.conn.execute("SELECT key, value from `{}`"
                                   .format(hash(bucket))):
         yield (k, dejsonify(decompress(v)))
Ejemplo n.º 4
0
 def getAllObjects(self, bucket):
     if not self._bucket_exists(bucket):
         return
     for k, v in self.conn.execute("SELECT key, value from `{}`".format(
             hash(bucket))):
         yield (k, dejsonify(decompress(v)))