Skip to content

Commit

Permalink
Remove unused function sql_next_id_factory().
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardomurri committed Apr 18, 2018
1 parent 9b9d687 commit 2e85ba8
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions gc3libs/persistence/sql.py
Expand Up @@ -44,33 +44,6 @@
from gc3libs.persistence.store import Store


def sql_next_id_factory(db):
"""
This function will return a function which can be used as
`next_id_fn` argument for the `IdFactory` class constructor.
`db` is DB connection class conform to DB API2.0 specs (works also
with SQLAlchemy engine types)
The function returned has signature:
sql_next_id(n=1)
the id returned is the maximum `id` field in the `store` table plus
1.
"""
def sql_next_id(n=1):
q = db.execute('select max(id) from store')
nextid = q.fetchone()[0]
if not nextid:
nextid = 1
else:
nextid = int(nextid) + 1
return nextid

return sql_next_id


class IntId(int):

def __new__(cls, prefix, seqno):
Expand Down

0 comments on commit 2e85ba8

Please sign in to comment.