psqlpy 0.11.1__tar.gz → 0.11.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of psqlpy might be problematic. Click here for more details.
- {psqlpy-0.11.1 → psqlpy-0.11.2}/.github/workflows/release.yml +3 -3
- {psqlpy-0.11.1 → psqlpy-0.11.2}/.github/workflows/test.yaml +1 -1
- {psqlpy-0.11.1 → psqlpy-0.11.2}/.pre-commit-config.yaml +3 -1
- {psqlpy-0.11.1 → psqlpy-0.11.2}/Cargo.lock +15 -16
- {psqlpy-0.11.1 → psqlpy-0.11.2}/Cargo.toml +2 -2
- {psqlpy-0.11.1 → psqlpy-0.11.2}/PKG-INFO +1 -1
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/psqlpy/_internal/__init__.pyi +0 -10
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/connection/impls.rs +98 -51
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/connection/structs.rs +2 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/connection/traits.rs +1 -2
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/driver/common.rs +20 -3
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/driver/connection.rs +4 -4
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/driver/connection_pool.rs +6 -2
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/driver/connection_pool_builder.rs +1 -1
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/driver/cursor.rs +12 -9
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/driver/listener/core.rs +9 -3
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/driver/listener/structs.rs +1 -1
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/driver/prepared_statement.rs +4 -3
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/driver/transaction.rs +60 -6
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/extra_types.rs +1 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/query_result.rs +11 -16
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/row_factories.rs +7 -4
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/statement/cache.rs +6 -7
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/statement/mod.rs +1 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/statement/parameters.rs +21 -16
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/statement/query.rs +7 -6
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/statement/statement.rs +13 -7
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/statement/statement_builder.rs +35 -33
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/transaction/impls.rs +8 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/additional_types.rs +100 -115
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/consts.rs +2 -5
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/dto/converter_impls.rs +5 -5
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/dto/funcs.rs +1 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/from_python.rs +8 -9
- psqlpy-0.11.2/src/value_converter/models/decimal.rs +42 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/models/interval.rs +16 -7
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/models/serde_value.rs +15 -8
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/models/uuid.rs +13 -4
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/to_python.rs +108 -106
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/traits.rs +2 -0
- psqlpy-0.11.1/src/value_converter/models/decimal.rs +0 -30
- {psqlpy-0.11.1 → psqlpy-0.11.2}/.github/actions/setup_postgres/action.yaml +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/.github/pull_request_template.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/.github/workflows/release_docs.yaml +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/.gitignore +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/LICENSE +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/README.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/.vuepress/config.ts +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/.vuepress/public/logo.png +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/.vuepress/sidebar.ts +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/.vuepress/styles/config.scss +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/.vuepress/styles/index.scss +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/.vuepress/styles/palette.scss +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/README.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/benchmarks.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/components/components_overview.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/components/connection.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/components/connection_pool.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/components/connection_pool_builder.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/components/cursor.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/components/exceptions.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/components/listener.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/components/prepared_statement.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/components/results.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/components/transaction.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/contribute.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/external_connection_pools.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/faq.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/integrations/opentelemetry.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/integrations/taskiq.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/introduction/components_overview.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/introduction/introduction.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/introduction/lets_start.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/frameworks/aiohttp.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/frameworks/blacksheep.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/frameworks/fastapi.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/frameworks/frameworks.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/frameworks/litestar.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/frameworks/robyn.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/parameters.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/row_factories/predefined_row_factories.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/row_factories/row_factories.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/types/advanced_type_usage.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/types/array_types.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/types/extra_types.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/types/supported_types.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/types/types.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/docs/usage/usage.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/examples/aiohttp/start_example.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/examples/fastapi/advanced_example.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/examples/fastapi/start_example.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/package.json +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/pnpm-lock.yaml +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/.gitignore +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/.pre-commit-config.yaml +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/Dockerfile +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/README.md +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/alembic.ini +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/poetry.lock +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/__init__.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/api/__init__.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/api/piccolo.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/api/plain_queries.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/app.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/helpers.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/lifecycle.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/migrations/README +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/migrations/env.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/migrations/script.py.mako +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/migrations/versions/06d989926550_basic_user_table.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/migrations/versions/d162c084f522_big_af_table.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/mocker.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/models/__init__.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/models/piccolo.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/models/sqlalchemy.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/piccolo_conf.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/psqlpy_stress/settings.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/psqlpy-stress/pyproject.toml +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/pyproject.toml +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/psqlpy/__init__.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/psqlpy/_internal/exceptions.pyi +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/psqlpy/_internal/extra_types.pyi +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/psqlpy/_internal/row_factories.pyi +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/psqlpy/exceptions.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/psqlpy/extra_types.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/psqlpy/py.typed +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/psqlpy/row_factories.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/__init__.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/conftest.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/helpers.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/test_binary_copy.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/test_connection.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/test_connection_pool.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/test_connection_pool_builder.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/test_cursor.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/test_data/MTcars.parquet +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/test_kwargs_parameters.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/test_listener.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/test_row_factories.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/test_ssl_mode.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/test_transaction.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/python/tests/test_value_converter.py +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/common.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/connection/mod.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/driver/listener/mod.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/driver/mod.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/driver/utils.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/exceptions/mod.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/exceptions/python_errors.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/exceptions/rust_errors.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/format_helpers.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/lib.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/options.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/runtime.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/statement/utils.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/transaction/mod.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/transaction/structs.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/dto/enums.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/dto/impls.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/dto/mod.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/mod.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/models/mod.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/src/value_converter/utils.rs +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/tox.ini +0 -0
- {psqlpy-0.11.1 → psqlpy-0.11.2}/tsconfig.json +0 -0
|
@@ -25,7 +25,7 @@ jobs:
|
|
|
25
25
|
uses: PyO3/maturin-action@v1
|
|
26
26
|
with:
|
|
27
27
|
target: ${{ matrix.target }}
|
|
28
|
-
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10
|
|
28
|
+
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10 pypy3.11
|
|
29
29
|
sccache: 'true'
|
|
30
30
|
manylinux: auto
|
|
31
31
|
before-script-linux: |
|
|
@@ -112,7 +112,7 @@ jobs:
|
|
|
112
112
|
uses: PyO3/maturin-action@v1
|
|
113
113
|
with:
|
|
114
114
|
target: ${{ matrix.target }}
|
|
115
|
-
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10
|
|
115
|
+
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10 pypy3.11
|
|
116
116
|
sccache: 'true'
|
|
117
117
|
- name: Upload wheels
|
|
118
118
|
uses: actions/upload-artifact@v4
|
|
@@ -168,7 +168,7 @@ jobs:
|
|
|
168
168
|
uses: messense/maturin-action@v1
|
|
169
169
|
with:
|
|
170
170
|
target: ${{ matrix.target }}
|
|
171
|
-
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10
|
|
171
|
+
args: --release --out dist -i 3.9 3.10 3.11 3.12 3.13 pypy3.9 pypy3.10 pypy3.11
|
|
172
172
|
manylinux: musllinux_1_2
|
|
173
173
|
- name: Upload wheels
|
|
174
174
|
uses: actions/upload-artifact@v4
|
|
@@ -30,7 +30,7 @@ jobs:
|
|
|
30
30
|
- uses: actions-rs/clippy-check@v1
|
|
31
31
|
with:
|
|
32
32
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
33
|
-
args: -p psqlpy --all-features -- -W clippy::all -W clippy::pedantic
|
|
33
|
+
args: -p psqlpy --all-features -- -W clippy::all -W clippy::pedantic -D warnings
|
|
34
34
|
pytest:
|
|
35
35
|
name: ${{matrix.job.os}}-${{matrix.py_version}}-${{ matrix.postgres_version }}
|
|
36
36
|
strategy:
|
|
@@ -3,7 +3,7 @@ ci:
|
|
|
3
3
|
|
|
4
4
|
repos:
|
|
5
5
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
6
|
-
rev:
|
|
6
|
+
rev: v5.0.0
|
|
7
7
|
hooks:
|
|
8
8
|
- id: trailing-whitespace
|
|
9
9
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
@@ -58,6 +58,8 @@ repos:
|
|
|
58
58
|
- clippy::all
|
|
59
59
|
- -W
|
|
60
60
|
- clippy::pedantic
|
|
61
|
+
- -D
|
|
62
|
+
- warnings
|
|
61
63
|
|
|
62
64
|
- id: check
|
|
63
65
|
types:
|
|
@@ -1006,7 +1006,7 @@ dependencies = [
|
|
|
1006
1006
|
|
|
1007
1007
|
[[package]]
|
|
1008
1008
|
name = "psqlpy"
|
|
1009
|
-
version = "0.11.
|
|
1009
|
+
version = "0.11.2"
|
|
1010
1010
|
dependencies = [
|
|
1011
1011
|
"byteorder",
|
|
1012
1012
|
"bytes",
|
|
@@ -1063,11 +1063,10 @@ dependencies = [
|
|
|
1063
1063
|
|
|
1064
1064
|
[[package]]
|
|
1065
1065
|
name = "pyo3"
|
|
1066
|
-
version = "0.
|
|
1066
|
+
version = "0.25.1"
|
|
1067
1067
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1068
|
-
checksum = "
|
|
1068
|
+
checksum = "8970a78afe0628a3e3430376fc5fd76b6b45c4d43360ffd6cdd40bdde72b682a"
|
|
1069
1069
|
dependencies = [
|
|
1070
|
-
"cfg-if",
|
|
1071
1070
|
"chrono",
|
|
1072
1071
|
"indoc",
|
|
1073
1072
|
"inventory",
|
|
@@ -1084,8 +1083,8 @@ dependencies = [
|
|
|
1084
1083
|
|
|
1085
1084
|
[[package]]
|
|
1086
1085
|
name = "pyo3-async-runtimes"
|
|
1087
|
-
version = "0.
|
|
1088
|
-
source = "git+https://github.com/chandr-andr/pyo3-async-runtimes.git?branch=psqlpy#
|
|
1086
|
+
version = "0.25.0"
|
|
1087
|
+
source = "git+https://github.com/chandr-andr/pyo3-async-runtimes.git?branch=psqlpy#74cd232b0606cd9e0dcab291bd10a8cadf69a1ed"
|
|
1089
1088
|
dependencies = [
|
|
1090
1089
|
"futures",
|
|
1091
1090
|
"once_cell",
|
|
@@ -1096,9 +1095,9 @@ dependencies = [
|
|
|
1096
1095
|
|
|
1097
1096
|
[[package]]
|
|
1098
1097
|
name = "pyo3-build-config"
|
|
1099
|
-
version = "0.
|
|
1098
|
+
version = "0.25.1"
|
|
1100
1099
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1101
|
-
checksum = "
|
|
1100
|
+
checksum = "458eb0c55e7ece017adeba38f2248ff3ac615e53660d7c71a238d7d2a01c7598"
|
|
1102
1101
|
dependencies = [
|
|
1103
1102
|
"once_cell",
|
|
1104
1103
|
"target-lexicon",
|
|
@@ -1106,9 +1105,9 @@ dependencies = [
|
|
|
1106
1105
|
|
|
1107
1106
|
[[package]]
|
|
1108
1107
|
name = "pyo3-ffi"
|
|
1109
|
-
version = "0.
|
|
1108
|
+
version = "0.25.1"
|
|
1110
1109
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1111
|
-
checksum = "
|
|
1110
|
+
checksum = "7114fe5457c61b276ab77c5055f206295b812608083644a5c5b2640c3102565c"
|
|
1112
1111
|
dependencies = [
|
|
1113
1112
|
"libc",
|
|
1114
1113
|
"pyo3-build-config",
|
|
@@ -1116,9 +1115,9 @@ dependencies = [
|
|
|
1116
1115
|
|
|
1117
1116
|
[[package]]
|
|
1118
1117
|
name = "pyo3-macros"
|
|
1119
|
-
version = "0.
|
|
1118
|
+
version = "0.25.1"
|
|
1120
1119
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1121
|
-
checksum = "
|
|
1120
|
+
checksum = "a8725c0a622b374d6cb051d11a0983786448f7785336139c3c94f5aa6bef7e50"
|
|
1122
1121
|
dependencies = [
|
|
1123
1122
|
"proc-macro2",
|
|
1124
1123
|
"pyo3-macros-backend",
|
|
@@ -1128,9 +1127,9 @@ dependencies = [
|
|
|
1128
1127
|
|
|
1129
1128
|
[[package]]
|
|
1130
1129
|
name = "pyo3-macros-backend"
|
|
1131
|
-
version = "0.
|
|
1130
|
+
version = "0.25.1"
|
|
1132
1131
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1133
|
-
checksum = "
|
|
1132
|
+
checksum = "4109984c22491085343c05b0dbc54ddc405c3cf7b4374fc533f5c3313a572ccc"
|
|
1134
1133
|
dependencies = [
|
|
1135
1134
|
"heck",
|
|
1136
1135
|
"proc-macro2",
|
|
@@ -1473,9 +1472,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
|
|
1473
1472
|
|
|
1474
1473
|
[[package]]
|
|
1475
1474
|
name = "target-lexicon"
|
|
1476
|
-
version = "0.
|
|
1475
|
+
version = "0.13.2"
|
|
1477
1476
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1478
|
-
checksum = "
|
|
1477
|
+
checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a"
|
|
1479
1478
|
|
|
1480
1479
|
[[package]]
|
|
1481
1480
|
name = "thiserror"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "psqlpy"
|
|
3
|
-
version = "0.11.
|
|
3
|
+
version = "0.11.2"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
|
|
6
6
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
@@ -10,7 +10,7 @@ crate-type = ["cdylib"]
|
|
|
10
10
|
|
|
11
11
|
[dependencies]
|
|
12
12
|
deadpool-postgres = { git = "https://github.com/chandr-andr/deadpool.git", branch = "psqlpy" }
|
|
13
|
-
pyo3 = { version = "0.
|
|
13
|
+
pyo3 = { version = "0.25.1", features = [
|
|
14
14
|
"chrono",
|
|
15
15
|
"experimental-async",
|
|
16
16
|
"rust_decimal",
|
|
@@ -815,16 +815,6 @@ class Connection:
|
|
|
815
815
|
|
|
816
816
|
Return representation of prepared statement.
|
|
817
817
|
"""
|
|
818
|
-
async def commit(self: Self) -> None:
|
|
819
|
-
"""Commit the transaction.
|
|
820
|
-
|
|
821
|
-
Do nothing if there is no active transaction.
|
|
822
|
-
"""
|
|
823
|
-
async def rollback(self: Self) -> None:
|
|
824
|
-
"""Rollback the transaction.
|
|
825
|
-
|
|
826
|
-
Do nothing if there is no active transaction.
|
|
827
|
-
"""
|
|
828
818
|
async def execute(
|
|
829
819
|
self: Self,
|
|
830
820
|
querystring: str,
|
|
@@ -31,9 +31,9 @@ where
|
|
|
31
31
|
) -> PSQLPyResult<()> {
|
|
32
32
|
let start_qs = self.build_start_qs(isolation_level, read_variant, deferrable);
|
|
33
33
|
self.batch_execute(start_qs.as_str()).await.map_err(|err| {
|
|
34
|
-
RustPSQLDriverError::TransactionBeginError(
|
|
35
|
-
|
|
36
|
-
)
|
|
34
|
+
RustPSQLDriverError::TransactionBeginError(format!(
|
|
35
|
+
"Cannot start transaction due to - {err}"
|
|
36
|
+
))
|
|
37
37
|
})?;
|
|
38
38
|
|
|
39
39
|
Ok(())
|
|
@@ -65,7 +65,7 @@ impl Connection for SingleConnection {
|
|
|
65
65
|
if !prepared {
|
|
66
66
|
self.drop_prepared(&prepared_stmt).await?;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
Ok(prepared_stmt)
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
async fn drop_prepared(&self, stmt: &Statement) -> PSQLPyResult<()> {
|
|
@@ -110,34 +110,36 @@ impl Connection for SingleConnection {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
impl StartTransaction for SingleConnection {
|
|
113
|
+
#[allow(clippy::used_underscore_items)]
|
|
113
114
|
async fn start_transaction(
|
|
114
115
|
&mut self,
|
|
115
116
|
isolation_level: Option<IsolationLevel>,
|
|
116
117
|
read_variant: Option<ReadVariant>,
|
|
117
118
|
deferrable: Option<bool>,
|
|
118
119
|
) -> PSQLPyResult<()> {
|
|
119
|
-
|
|
120
|
-
._start_transaction(isolation_level, read_variant, deferrable)
|
|
120
|
+
self._start_transaction(isolation_level, read_variant, deferrable)
|
|
121
121
|
.await?;
|
|
122
122
|
self.in_transaction = true;
|
|
123
123
|
|
|
124
|
-
Ok(
|
|
124
|
+
Ok(())
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
impl CloseTransaction for SingleConnection {
|
|
129
|
+
#[allow(clippy::used_underscore_items)]
|
|
129
130
|
async fn commit(&mut self) -> PSQLPyResult<()> {
|
|
130
|
-
|
|
131
|
+
self._commit().await?;
|
|
131
132
|
self.in_transaction = false;
|
|
132
133
|
|
|
133
|
-
Ok(
|
|
134
|
+
Ok(())
|
|
134
135
|
}
|
|
135
136
|
|
|
137
|
+
#[allow(clippy::used_underscore_items)]
|
|
136
138
|
async fn rollback(&mut self) -> PSQLPyResult<()> {
|
|
137
|
-
|
|
139
|
+
self._rollback().await?;
|
|
138
140
|
self.in_transaction = false;
|
|
139
141
|
|
|
140
|
-
Ok(
|
|
142
|
+
Ok(())
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
|
|
@@ -149,7 +151,7 @@ impl Connection for PoolConnection {
|
|
|
149
151
|
|
|
150
152
|
let prepared = self.connection.prepare(query).await?;
|
|
151
153
|
self.drop_prepared(&prepared).await?;
|
|
152
|
-
|
|
154
|
+
Ok(prepared)
|
|
153
155
|
}
|
|
154
156
|
|
|
155
157
|
async fn drop_prepared(&self, stmt: &Statement) -> PSQLPyResult<()> {
|
|
@@ -194,6 +196,7 @@ impl Connection for PoolConnection {
|
|
|
194
196
|
}
|
|
195
197
|
|
|
196
198
|
impl StartTransaction for PoolConnection {
|
|
199
|
+
#[allow(clippy::used_underscore_items)]
|
|
197
200
|
async fn start_transaction(
|
|
198
201
|
&mut self,
|
|
199
202
|
isolation_level: Option<IsolationLevel>,
|
|
@@ -207,18 +210,20 @@ impl StartTransaction for PoolConnection {
|
|
|
207
210
|
}
|
|
208
211
|
|
|
209
212
|
impl CloseTransaction for PoolConnection {
|
|
213
|
+
#[allow(clippy::used_underscore_items)]
|
|
210
214
|
async fn commit(&mut self) -> PSQLPyResult<()> {
|
|
211
|
-
|
|
215
|
+
self._commit().await?;
|
|
212
216
|
self.in_transaction = false;
|
|
213
217
|
|
|
214
|
-
Ok(
|
|
218
|
+
Ok(())
|
|
215
219
|
}
|
|
216
220
|
|
|
221
|
+
#[allow(clippy::used_underscore_items)]
|
|
217
222
|
async fn rollback(&mut self) -> PSQLPyResult<()> {
|
|
218
|
-
|
|
223
|
+
self._rollback().await?;
|
|
219
224
|
self.in_transaction = false;
|
|
220
225
|
|
|
221
|
-
Ok(
|
|
226
|
+
Ok(())
|
|
222
227
|
}
|
|
223
228
|
}
|
|
224
229
|
|
|
@@ -325,6 +330,7 @@ impl CloseTransaction for PSQLPyConnection {
|
|
|
325
330
|
}
|
|
326
331
|
|
|
327
332
|
impl PSQLPyConnection {
|
|
333
|
+
#[must_use]
|
|
328
334
|
pub fn in_transaction(&self) -> bool {
|
|
329
335
|
match self {
|
|
330
336
|
PSQLPyConnection::PoolConn(conn) => conn.in_transaction,
|
|
@@ -332,6 +338,10 @@ impl PSQLPyConnection {
|
|
|
332
338
|
}
|
|
333
339
|
}
|
|
334
340
|
|
|
341
|
+
/// Prepare internal `PSQLPy` statement
|
|
342
|
+
///
|
|
343
|
+
/// # Errors
|
|
344
|
+
/// May return error if there is some problem with DB communication.
|
|
335
345
|
pub async fn prepare_statement(
|
|
336
346
|
&self,
|
|
337
347
|
querystring: String,
|
|
@@ -342,6 +352,10 @@ impl PSQLPyConnection {
|
|
|
342
352
|
.await
|
|
343
353
|
}
|
|
344
354
|
|
|
355
|
+
/// Execute prepared `PSQLPy` statement.
|
|
356
|
+
///
|
|
357
|
+
/// # Errors
|
|
358
|
+
/// May return error if there is some problem with DB communication.
|
|
345
359
|
pub async fn execute_statement(
|
|
346
360
|
&self,
|
|
347
361
|
statement: &PsqlpyStatement,
|
|
@@ -353,6 +367,10 @@ impl PSQLPyConnection {
|
|
|
353
367
|
Ok(PSQLDriverPyQueryResult::new(result))
|
|
354
368
|
}
|
|
355
369
|
|
|
370
|
+
/// Execute raw query with parameters.
|
|
371
|
+
///
|
|
372
|
+
/// # Errors
|
|
373
|
+
/// May return error if there is some problem with DB communication.
|
|
356
374
|
pub async fn execute(
|
|
357
375
|
&self,
|
|
358
376
|
querystring: String,
|
|
@@ -364,15 +382,12 @@ impl PSQLPyConnection {
|
|
|
364
382
|
.await?;
|
|
365
383
|
|
|
366
384
|
let prepared = prepared.unwrap_or(true);
|
|
367
|
-
let result =
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
self.query_typed(statement.raw_query(), &statement.params_typed())
|
|
374
|
-
.await
|
|
375
|
-
}
|
|
385
|
+
let result = if prepared {
|
|
386
|
+
self.query(statement.statement_query()?, &statement.params())
|
|
387
|
+
.await
|
|
388
|
+
} else {
|
|
389
|
+
self.query_typed(statement.raw_query(), &statement.params_typed())
|
|
390
|
+
.await
|
|
376
391
|
};
|
|
377
392
|
|
|
378
393
|
let return_result = result.map_err(|err| {
|
|
@@ -384,6 +399,10 @@ impl PSQLPyConnection {
|
|
|
384
399
|
Ok(PSQLDriverPyQueryResult::new(return_result))
|
|
385
400
|
}
|
|
386
401
|
|
|
402
|
+
/// Execute many queries without return.
|
|
403
|
+
///
|
|
404
|
+
/// # Errors
|
|
405
|
+
/// May return error if there is some problem with DB communication.
|
|
387
406
|
pub async fn execute_many(
|
|
388
407
|
&self,
|
|
389
408
|
querystring: String,
|
|
@@ -407,14 +426,14 @@ impl PSQLPyConnection {
|
|
|
407
426
|
|
|
408
427
|
for statement in statements {
|
|
409
428
|
let querystring_result = if prepared {
|
|
410
|
-
let prepared_stmt = &self.prepare(
|
|
429
|
+
let prepared_stmt = &self.prepare(statement.raw_query(), true).await;
|
|
411
430
|
if let Err(error) = prepared_stmt {
|
|
412
431
|
return Err(RustPSQLDriverError::ConnectionExecuteError(format!(
|
|
413
432
|
"Cannot prepare statement in execute_many, operation rolled back {error}",
|
|
414
433
|
)));
|
|
415
434
|
}
|
|
416
435
|
self.query(
|
|
417
|
-
&self.prepare(
|
|
436
|
+
&self.prepare(statement.raw_query(), true).await?,
|
|
418
437
|
&statement.params(),
|
|
419
438
|
)
|
|
420
439
|
.await
|
|
@@ -429,9 +448,14 @@ impl PSQLPyConnection {
|
|
|
429
448
|
}
|
|
430
449
|
}
|
|
431
450
|
|
|
432
|
-
|
|
451
|
+
Ok(())
|
|
433
452
|
}
|
|
434
453
|
|
|
454
|
+
/// Execute raw query with parameters. Return one raw row
|
|
455
|
+
///
|
|
456
|
+
/// # Errors
|
|
457
|
+
/// May return error if there is some problem with DB communication.
|
|
458
|
+
/// Or if cannot build statement.
|
|
435
459
|
pub async fn fetch_row_raw(
|
|
436
460
|
&self,
|
|
437
461
|
querystring: String,
|
|
@@ -447,7 +471,7 @@ impl PSQLPyConnection {
|
|
|
447
471
|
let result = if prepared {
|
|
448
472
|
self.query_one(
|
|
449
473
|
&self
|
|
450
|
-
.prepare(
|
|
474
|
+
.prepare(statement.raw_query(), true)
|
|
451
475
|
.await
|
|
452
476
|
.map_err(|err| {
|
|
453
477
|
RustPSQLDriverError::ConnectionExecuteError(format!(
|
|
@@ -464,9 +488,14 @@ impl PSQLPyConnection {
|
|
|
464
488
|
.map_err(|err| RustPSQLDriverError::ConnectionExecuteError(format!("{err}")))?
|
|
465
489
|
};
|
|
466
490
|
|
|
467
|
-
|
|
491
|
+
Ok(result)
|
|
468
492
|
}
|
|
469
493
|
|
|
494
|
+
/// Execute raw query with parameters. Return one row
|
|
495
|
+
///
|
|
496
|
+
/// # Errors
|
|
497
|
+
/// May return error if there is some problem with DB communication.
|
|
498
|
+
/// Or if cannot build statement.
|
|
470
499
|
pub async fn fetch_row(
|
|
471
500
|
&self,
|
|
472
501
|
querystring: String,
|
|
@@ -477,9 +506,14 @@ impl PSQLPyConnection {
|
|
|
477
506
|
.fetch_row_raw(querystring, parameters, prepared)
|
|
478
507
|
.await?;
|
|
479
508
|
|
|
480
|
-
|
|
509
|
+
Ok(PSQLDriverSinglePyQueryResult::new(result))
|
|
481
510
|
}
|
|
482
511
|
|
|
512
|
+
/// Execute raw query with parameters. Return single python object
|
|
513
|
+
///
|
|
514
|
+
/// # Errors
|
|
515
|
+
/// May return error if there is some problem with DB communication.
|
|
516
|
+
/// Or if cannot build statement.
|
|
483
517
|
pub async fn fetch_val(
|
|
484
518
|
&self,
|
|
485
519
|
querystring: String,
|
|
@@ -490,12 +524,17 @@ impl PSQLPyConnection {
|
|
|
490
524
|
.fetch_row_raw(querystring, parameters, prepared)
|
|
491
525
|
.await?;
|
|
492
526
|
|
|
493
|
-
|
|
527
|
+
Python::with_gil(|gil| match result.columns().first() {
|
|
494
528
|
Some(first_column) => postgres_to_py(gil, &result, first_column, 0, &None),
|
|
495
529
|
None => Ok(gil.None()),
|
|
496
|
-
})
|
|
530
|
+
})
|
|
497
531
|
}
|
|
498
532
|
|
|
533
|
+
/// Create new sink for COPY operation.
|
|
534
|
+
///
|
|
535
|
+
/// # Errors
|
|
536
|
+
/// May return error if there is some problem with DB communication.
|
|
537
|
+
/// Or if cannot build statement.
|
|
499
538
|
pub async fn copy_in<T, U>(&self, statement: &T) -> PSQLPyResult<CopyInSink<U>>
|
|
500
539
|
where
|
|
501
540
|
T: ?Sized + ToStatement,
|
|
@@ -511,6 +550,14 @@ impl PSQLPyConnection {
|
|
|
511
550
|
}
|
|
512
551
|
}
|
|
513
552
|
|
|
553
|
+
/// Create and open new transaction.
|
|
554
|
+
///
|
|
555
|
+
/// Unsafe here isn't a problem cuz it is stored within
|
|
556
|
+
/// the struct with the connection created this transaction.
|
|
557
|
+
///
|
|
558
|
+
/// # Errors
|
|
559
|
+
/// May return error if there is some problem with DB communication.
|
|
560
|
+
/// Or if cannot build statement.
|
|
514
561
|
pub async fn transaction(&mut self) -> PSQLPyResult<PSQLPyTransaction> {
|
|
515
562
|
match self {
|
|
516
563
|
PSQLPyConnection::PoolConn(conn) => {
|
|
@@ -532,33 +579,33 @@ impl PSQLPyConnection {
|
|
|
532
579
|
}
|
|
533
580
|
}
|
|
534
581
|
|
|
582
|
+
/// Create new Portal (server-side byte cursor).
|
|
583
|
+
///
|
|
584
|
+
/// # Errors
|
|
585
|
+
/// May return error if there is some problem with DB communication.
|
|
586
|
+
/// Or if cannot build statement.
|
|
535
587
|
pub async fn portal(
|
|
536
588
|
&mut self,
|
|
537
589
|
querystring: Option<&String>,
|
|
538
590
|
parameters: &Option<pyo3::Py<PyAny>>,
|
|
539
591
|
statement: Option<&PsqlpyStatement>,
|
|
540
592
|
) -> PSQLPyResult<(PSQLPyTransaction, tp_Portal)> {
|
|
541
|
-
let
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
.await?
|
|
554
|
-
}
|
|
555
|
-
}
|
|
593
|
+
let stmt = if let Some(stmt) = statement {
|
|
594
|
+
stmt
|
|
595
|
+
} else {
|
|
596
|
+
let Some(querystring) = querystring else {
|
|
597
|
+
return Err(RustPSQLDriverError::ConnectionExecuteError(
|
|
598
|
+
"Can't create cursor without querystring".into(),
|
|
599
|
+
));
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
&StatementBuilder::new(querystring, parameters, self, Some(false))
|
|
603
|
+
.build()
|
|
604
|
+
.await?
|
|
556
605
|
};
|
|
557
606
|
|
|
558
607
|
let transaction = self.transaction().await?;
|
|
559
|
-
let inner_portal = transaction
|
|
560
|
-
.portal(statement.raw_query(), &statement.params())
|
|
561
|
-
.await?;
|
|
608
|
+
let inner_portal = transaction.portal(stmt.raw_query(), &stmt.params()).await?;
|
|
562
609
|
|
|
563
610
|
Ok((transaction, inner_portal))
|
|
564
611
|
}
|
|
@@ -12,6 +12,7 @@ pub struct PoolConnection {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
impl PoolConnection {
|
|
15
|
+
#[must_use]
|
|
15
16
|
pub fn new(connection: Object, pg_config: Arc<Config>) -> Self {
|
|
16
17
|
Self {
|
|
17
18
|
connection,
|
|
@@ -31,6 +32,7 @@ pub struct SingleConnection {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
impl SingleConnection {
|
|
35
|
+
#[must_use]
|
|
34
36
|
pub fn new(connection: Client, pg_config: Arc<Config>) -> Self {
|
|
35
37
|
Self {
|
|
36
38
|
connection,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
use postgres_types::{ToSql, Type};
|
|
2
|
-
use pyo3::PyAny;
|
|
3
2
|
use tokio_postgres::{Row, Statement, ToStatement};
|
|
4
3
|
|
|
5
4
|
use crate::exceptions::rust_errors::PSQLPyResult;
|
|
@@ -58,7 +57,7 @@ pub trait Transaction {
|
|
|
58
57
|
if let Some(level) = isolation_level {
|
|
59
58
|
let level = &level.to_str_level();
|
|
60
59
|
querystring.push_str(format!(" ISOLATION LEVEL {level}").as_str());
|
|
61
|
-
}
|
|
60
|
+
}
|
|
62
61
|
|
|
63
62
|
querystring.push_str(match read_variant {
|
|
64
63
|
Some(ReadVariant::ReadOnly) => " READ ONLY",
|
|
@@ -133,20 +133,21 @@ macro_rules! impl_cursor_method {
|
|
|
133
133
|
#[pymethods]
|
|
134
134
|
impl $name {
|
|
135
135
|
#[pyo3(signature = (querystring=None, parameters=None, array_size=None))]
|
|
136
|
+
#[must_use]
|
|
136
137
|
pub fn cursor(
|
|
137
138
|
&self,
|
|
138
139
|
querystring: Option<String>,
|
|
139
140
|
parameters: Option<Py<PyAny>>,
|
|
140
141
|
array_size: Option<i32>,
|
|
141
|
-
) ->
|
|
142
|
-
|
|
142
|
+
) -> Cursor {
|
|
143
|
+
Cursor::new(
|
|
143
144
|
self.conn.clone(),
|
|
144
145
|
querystring,
|
|
145
146
|
parameters,
|
|
146
147
|
array_size,
|
|
147
148
|
self.pg_config.clone(),
|
|
148
149
|
None,
|
|
149
|
-
)
|
|
150
|
+
)
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
};
|
|
@@ -159,6 +160,10 @@ macro_rules! impl_prepare_method {
|
|
|
159
160
|
($name:ident) => {
|
|
160
161
|
#[pymethods]
|
|
161
162
|
impl $name {
|
|
163
|
+
/// Create new prepared statement.
|
|
164
|
+
///
|
|
165
|
+
/// # Errors
|
|
166
|
+
/// May return error if there is some problem with DB communication.
|
|
162
167
|
#[pyo3(signature = (querystring, parameters=None))]
|
|
163
168
|
pub async fn prepare(
|
|
164
169
|
&self,
|
|
@@ -191,6 +196,10 @@ macro_rules! impl_transaction_methods {
|
|
|
191
196
|
($name:ident, $val:expr $(,)?) => {
|
|
192
197
|
#[pymethods]
|
|
193
198
|
impl $name {
|
|
199
|
+
/// Commit existing transaction.
|
|
200
|
+
///
|
|
201
|
+
/// # Errors
|
|
202
|
+
/// May return error if there is some problem with DB communication.
|
|
194
203
|
pub async fn commit(&mut self) -> PSQLPyResult<()> {
|
|
195
204
|
let conn = self.conn.clone();
|
|
196
205
|
let Some(conn) = conn else {
|
|
@@ -206,6 +215,10 @@ macro_rules! impl_transaction_methods {
|
|
|
206
215
|
Ok(())
|
|
207
216
|
}
|
|
208
217
|
|
|
218
|
+
/// Rollback existing transaction.
|
|
219
|
+
///
|
|
220
|
+
/// # Errors
|
|
221
|
+
/// May return error if there is some problem with DB communication.
|
|
209
222
|
pub async fn rollback(&mut self) -> PSQLPyResult<()> {
|
|
210
223
|
let conn = self.conn.clone();
|
|
211
224
|
let Some(conn) = conn else {
|
|
@@ -230,6 +243,10 @@ macro_rules! impl_binary_copy_method {
|
|
|
230
243
|
($name:ident) => {
|
|
231
244
|
#[pymethods]
|
|
232
245
|
impl $name {
|
|
246
|
+
/// Perform binary copy to table.
|
|
247
|
+
///
|
|
248
|
+
/// # Errors
|
|
249
|
+
/// May return error if there is some problem with DB communication.
|
|
233
250
|
#[pyo3(signature = (source, table_name, columns=None, schema_name=None))]
|
|
234
251
|
pub async fn binary_copy_to_table(
|
|
235
252
|
self_: pyo3::Py<Self>,
|
|
@@ -158,7 +158,7 @@ impl Connection {
|
|
|
158
158
|
read_conn_g.in_transaction()
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
async fn __aenter__
|
|
161
|
+
async fn __aenter__(self_: Py<Self>) -> PSQLPyResult<Py<Self>> {
|
|
162
162
|
let (db_client, db_pool, pg_config) = pyo3::Python::with_gil(|gil| {
|
|
163
163
|
let self_ = self_.borrow(gil);
|
|
164
164
|
(
|
|
@@ -191,7 +191,7 @@ impl Connection {
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
#[allow(clippy::unused_async)]
|
|
194
|
-
async fn __aexit__
|
|
194
|
+
async fn __aexit__(
|
|
195
195
|
self_: Py<Self>,
|
|
196
196
|
_exception_type: Py<PyAny>,
|
|
197
197
|
exception: Py<PyAny>,
|
|
@@ -278,7 +278,7 @@ impl Connection {
|
|
|
278
278
|
/// 1) Cannot convert python parameters
|
|
279
279
|
/// 2) Cannot execute querystring.
|
|
280
280
|
#[pyo3(signature = (querystring, parameters=None, prepared=None))]
|
|
281
|
-
pub async fn execute_many
|
|
281
|
+
pub async fn execute_many(
|
|
282
282
|
self_: pyo3::Py<Self>,
|
|
283
283
|
querystring: String,
|
|
284
284
|
parameters: Option<Vec<Py<PyAny>>>,
|
|
@@ -369,7 +369,7 @@ impl Connection {
|
|
|
369
369
|
/// 2) Cannot execute querystring.
|
|
370
370
|
/// 3) Query returns more than one row
|
|
371
371
|
#[pyo3(signature = (querystring, parameters=None, prepared=None))]
|
|
372
|
-
pub async fn fetch_val
|
|
372
|
+
pub async fn fetch_val(
|
|
373
373
|
self_: pyo3::Py<Self>,
|
|
374
374
|
querystring: String,
|
|
375
375
|
parameters: Option<pyo3::Py<PyAny>>,
|