Revize 94f6d8b8
Přidáno uživatelem Jan Pašek před asi 4 roky(ů)
src/dao/certificate_repository.py | ||
---|---|---|
388 | 388 |
raise DatabaseException(e) |
389 | 389 |
|
390 | 390 |
return certificates |
391 |
|
|
392 |
def get_next_id(self) -> int: |
|
393 |
""" |
|
394 |
Get identifier of the next certificate that will be inserted into the database |
|
395 |
:return: identifier of the next certificate that will be added into the database |
|
396 |
""" |
|
397 |
# get next IDs of all tables |
|
398 |
self.cursor.execute("SELECT * FROM SQLITE_SEQUENCE") |
|
399 |
results = self.cursor.fetchall() |
|
400 |
|
|
401 |
# search for next ID in Certificates table and return it |
|
402 |
for result in results: |
|
403 |
if result[0] == TAB_CERTIFICATES: |
|
404 |
return result[1] + 1 # current last id + 1 |
|
405 |
# if certificates table is not present in the query results, return 1 |
|
406 |
return 1 |
Také k dispozici: Unified diff
Re #8571 - Added get_next_id to CertificateRepository in order to be able to specify CRL/OCSP endpoints