コード例 #1
0
 def loadSignedPreKey(self, signedPreKeyId):
     query = 'SELECT record FROM signed_prekeys WHERE prekey_id = ?'
     result = self._con.execute(query, (signedPreKeyId, )).fetchone()
     if result is None:
         raise InvalidKeyIdException("No such signedprekeyrecord! %s " %
                                     signedPreKeyId)
     return SignedPreKeyRecord(serialized=result.record)
コード例 #2
0
    def loadSignedPreKeys(self):
        q = "SELECT record FROM signed_prekeys"

        cursor = self.dbConn.cursor()
        cursor.execute(q, )
        result = cursor.fetchall()
        results = []
        for row in result:
            results.append(SignedPreKeyRecord(serialized=row[0]))

        return results
コード例 #3
0
    def loadSignedPreKey(self, signedPreKeyId):
        q = "SELECT record FROM signed_prekeys WHERE prekey_id = ?"

        cursor = self.dbConn.cursor()
        cursor.execute(q, (signedPreKeyId, ))

        result = cursor.fetchone()
        if not result:
            raise Exception("No such signedprekeyrecord! %s " % signedPreKeyId)

        return SignedPreKeyRecord(serialized=result[0])
コード例 #4
0
 def loadSignedPreKeys(self):
     q = "SELECT record FROM {}_signed_prekeys".format(self.phoneNumber)
     dbConn = self.get_conn()
     cursor = dbConn.cursor()
     cursor.execute(q, )
     result = cursor.fetchall()
     results = []
     for row in result:
         results.append(SignedPreKeyRecord(serialized=row[0]))
     dbConn.close()
     return results
コード例 #5
0
    def loadSignedPreKey(self, signedPreKeyId):
        q = "SELECT record FROM {}_signed_prekeys WHERE prekey_id = %s".format(
            self.phoneNumber)
        dbConn = self.get_conn()
        cursor = dbConn.cursor()
        cursor.execute(q, (signedPreKeyId, ))
        result = cursor.fetchone()
        dbConn.close()
        if not result:
            raise InvalidKeyIdException(
                "No such signedprekeyrecord! {}  for phone {}".format(
                    signedPreKeyId, self.phoneNumber))

        return SignedPreKeyRecord(serialized=result[0])
コード例 #6
0
 def loadSignedPreKeys(self):
     query = 'SELECT record FROM signed_prekeys'
     results = self._con.execute(query).fetchall()
     return [SignedPreKeyRecord(serialized=row.record) for row in results]