From 72ed918931447b258cbd3bbb610d0255e0aaa183 Mon Sep 17 00:00:00 2001 From: Matteo Campinoti Date: Tue, 20 Aug 2024 10:22:37 +0200 Subject: [PATCH 1/3] database.base:Table.select - fix incorrect position of OFFSET in select statement --- acacore/database/base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acacore/database/base.py b/acacore/database/base.py index cc4b19c..ca25751 100644 --- a/acacore/database/base.py +++ b/acacore/database/base.py @@ -318,12 +318,12 @@ def select( order_statements = [f"{c.name if isinstance(c, Column) else c} {s}" for c, s in order_by] statement += f" ORDER BY {','.join(order_statements)}" - if offset is not None: - statement += f" OFFSET {offset}" - if limit is not None: statement += f" LIMIT {limit}" + if offset is not None: + statement += f" OFFSET {offset}" + return Cursor(self.connection.execute(statement, parameters), columns, self) def insert(self, entry: dict[str, Any], exist_ok: bool = False, replace: bool = False): From 7d48e52e3df2b29d9623327905f3eb0c5c483343 Mon Sep 17 00:00:00 2001 From: Matteo Campinoti Date: Tue, 20 Aug 2024 10:23:50 +0200 Subject: [PATCH 2/3] database.base:Table.select - only use offset if it is greater than 0 --- acacore/database/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acacore/database/base.py b/acacore/database/base.py index ca25751..d7749df 100644 --- a/acacore/database/base.py +++ b/acacore/database/base.py @@ -321,7 +321,7 @@ def select( if limit is not None: statement += f" LIMIT {limit}" - if offset is not None: + if offset is not None and offset > 0: statement += f" OFFSET {offset}" return Cursor(self.connection.execute(statement, parameters), columns, self) From cf6110d5dddf6cd6d36f8c6af8d31f2bc32c33b3 Mon Sep 17 00:00:00 2001 From: Matteo Campinoti Date: Tue, 20 Aug 2024 10:25:32 +0200 Subject: [PATCH 3/3] version - patch 3.0.2 > 3.0.3 --- acacore/__version__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/acacore/__version__.py b/acacore/__version__.py index 131942e..8d1c862 100644 --- a/acacore/__version__.py +++ b/acacore/__version__.py @@ -1 +1 @@ -__version__ = "3.0.2" +__version__ = "3.0.3" diff --git a/pyproject.toml b/pyproject.toml index 59f4d3e..cd172ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "acacore" -version = "3.0.2" +version = "3.0.3" description = "" authors = ["Matteo Campinoti "] license = "GPL-3.0"