Repository navigation
Refuse a lone dict for positional ? placeholders instead of binding NULL - #185
Merged
Merged
Conversation
…lders A lone dict (also [d] and (d,)) is the named-parameter map on both builds. The engine's Map overloads bind a positional ? with no key to NULL and nothing raises (ArcadeData/arcadedb#11098), so INSERT ... SET v = ? with {"a": 1} stored a record without v. refuse_dict_for_positionals (called first from refuse_surplus_positionals, which core.py and _native/database.py both call) raises TypeError for SQL and SQLScript when the text has a ? and no :name or $name outside string literals/backtick identifiers and no key is a digit string ({"0": v} keeps binding slot 0 by key). Tests in tests/test_dict_with_positional.py; Parameters docs section updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The three controls (named, positional list, digit-string key) wrote outside a transaction, which the engine refuses (Transaction not begun) on both builds; the repo's tests wrap writes in db.transaction(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eholders test_each_parameter_shape_reaches_one_java_overload sent a lone dict to 'SELECT ?, ?' to check that it reaches the Map overload; the new guard (#184) refuses exactly that call. Its two lone-dict cases now use 'SELECT :v, :w' and 'SELECT :p'; the dispatch it checks is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #184
Bindings-side guard for the silent
nullof ArcadeData/arcadedb#11098, on both builds.src/arcadedb/_params.py:refuse_dict_for_positionals, called first inrefuse_surplus_positionals(whichcore.pyquery/command and the native_execalready call), raisesTypeErrorwhen all hold: the language issqlorsqlscript; the arguments are a lone dict,[d]or(d,); the statement has a positional?and no:name/$nameplaceholder outside string literals and backtick identifiers (a small scanner,_placeholder_kinds, no SQL parsing); no key is a digit string ({"0": v}binds slot 0 by key on the engine and keeps working). The message says a dict is the NAMED map,?takes a list such as[value], and how to pass a dict as one value.how-to/databases-and-queries.adoc, Parameters): a dict is always the named map; the exact-count rule covers positional values; the new error and what to do instead.tests/test_dict_with_positional.py(shared): the three dict spellings refused bycommandandquery,sqlscript, an empty dict, the message; controls that keep binding (a dict with:v,[5]with?,?inside string literals,{"0": 7}, an openCypher named map); the scanner's literal handling (11 cases).Verification: against the main 26.11.1.dev0 wheels both builds fail the 20 refusal and scanner tests (nothing raises today, the scanner does not exist) and pass the 5 controls. bandit, black, isort, pyflakes clean.
🤖 Generated with Claude Code