8000 bpo-44165: Add tests for sqlite3 SQL string length by erlend-aasland · Pull Request #26485 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-44165: Add tests for sqlite3 SQL string length #26485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fetch max string length limit from compile time options
  • Loading branch information
Erlend E. Aasland committed Jun 2, 2021
commit 3687feaa7f38cc0d1134a000747bfe6514091ba2
8 changes: 7 additions & 1 deletion Lib/sqlite3/test/dbapi.py
6C71
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,14 @@ def test_execute_too_much_sql3(self):
def test_execute_too_long_string(self):
# The default value of SQLITE_MAX_LENGTH is 1_000_000_000, but it may
# be up to 2_147_483_647.
res = self.cu.execute("pragma compile_options")
opts = {k: v for k, v in [o[0].split("=") for o in res if "=" in o[0]]}
try:
too_long = " " * 2_147_483_648
max_length = int(opts['MAX_LENGTH'])
except (KeyError, TypeError):
max_length = 1_000_000_000
try:
too_long = " " * (max_length + 1)
except OverflowError:
self.skipTest("Unable to create too large SQL string")
regex = "query string is too large"
Expand Down
0