fix(database): flip adapter hardener S2 S6 S8 S12-S16 - #3419
Merged
Conversation
Quote AFTER, fix MSSQL schema.table brackets, and scope Oracle createTable loops. HOLD pins stay unflipped. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
$whereClause leaves the sql structs without values. The string null lands in $addWhereClauseParameters, which is the input $executeQuery reads after IS / IS NOT. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
Keep the bound string null after IS/IS NOT. Emit MySQL TEXT/float DEFAULT. Quote boolean yes/no. SQLite advisory locks unsupported. Unknown foreign-key actions throw. Empty string defaults throw Wheels.InvalidDefault. Unmapped $getType throws everywhere. Drop Oracle MAX(ROWID) and MSSQL @@IDENTITY last-resort. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
S14 throws Wheels.InvalidDefault for default="" on string columns. Fixtures meant "no default clause"; omit the argument instead. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
Keep the literal string "null" after IS / IS NOT as a bound parameter. Mark the unquoted NULL keyword and CFML/Java null as SQL NULL so an absent uniqueness-scope property does not cast [NULL] to a number. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.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.
Why
Peter superseded the HOLD lock on PR #3419, then requested changes at
2c969baa: S2 no-coerce blastedvalidatesUniquenessOf_with_absent_scope_property(cannot cast [NULL] string to a number). Keep S2. Distinguish the literal string"null"from a missing value.Scope
In:
vendor/wheels/databaseAdapters/plus the specs that own those adapters (vendor/wheels/tests/specs/database/).$addWhereClauseParametersmarks the unquoted SQL keywordNULLasnull=truewith a dummy value.$queryParamsbinds CFML/Java null as SQL NULL.$buildWhereClauseParttreats a Java-null property like absent.ForeignKeyDefinition.$appendReferentialActionsshares$referentialActionSQL.addColumnOptionsSpecfollows the S6/S14 contract. Migrator fixtures that passeddefault=""on string columns omit that argument.Out: second PR, channel DatabaseAdapter, engineAdapters, CLI, closer keywords.
Base tip:
804573157939475fc0fafe6a9713979eab28d9c7(develop after #3418).Tradeoffs
S14 contract (named):
Wheels.InvalidDefault. Both Abstract and PostgreSQL throw whendefault=""is applied tostring/text/char.S2: the quoted literal
'null'after IS / IS NOT stays a bound string. The unquoted keywordNULL(and a CFML/Java null) bind as SQL NULL so an absent uniqueness-scope integer does not send[NULL]tocfqueryparam.S13 known values stay:
none→ NO ACTION,null→ SET NULL,cascade/true→ CASCADE. Unknown values throwWheels.InvalidReferentialAction.S16 identity must use the real sequence / driver-key / same-batch
SCOPE_IDENTITYpath or throwWheels.IdentityNotFound.Blast Radius
"null"after IS / IS NOT stays a parameter (no string coerce)IS NULL/ absent / Java null bind as SQL NULLyes/noare quoted$supportsAdvisoryLocksis false$getTypethrowsWheels.UnknownColumnTypeon every adapterMAX(ROWID)and MSSQL@@IDENTITYlast-resort are gonePROVEN
$quoteValuethrowsWheels.InvalidValuefor"0 OR 1=1"and"maybe"'null'after IS / IS NOT stays a bound string;$executeQuerydoes not coerce that string. UnquotedNULL/ Java null bind as SQL NULL$getColumnscachecatch(any)falls through to a fresh catalog lookup$identitySequenceNamecatch(any)returns""optionsIncludeDefaultemits TEXT/float DEFAULT. Abstract stays always-truetoBeLTEand always-run order/pagination asserts$quoteValuequotes booleanyes/noaddColumnOptionsquotes AFTER throughquoteColumnNamecommit persists datanow commits and deletes the rowcf_sql_*types$supportsAdvisoryLocksis false. acquire stays a no-op and is unusedforeignKeySQLunknown onUpdate/onDelete throwsWheels.InvalidReferentialActionWheels.InvalidDefaultfordefault=""on string-like columns$getTypethrowsWheels.UnknownColumnTypeon PG / SQLite / MySQL / H2 / Oracle / MSSQLMAX(ROWID)and MSSQL@@IDENTITYlast-resort dropped; miss throwsWheels.IdentityNotFoundquoteTableName("dbo.users")is[schema].[table], no backtickscreateTableuseslocal.col/local.fkVerification
Commands actually run:
GREEN database (
4ca43b796a5a6402099f60e43fcf8be271199694):GREEN model:
validatesUniquenessOf_with_absent_scope_property: Passed.Adobe and BoxLang were not run here.
HEAD
4ca43b796a5a6402099f60e43fcf8be271199694No closer keywords. Do not merge.