Add throwOnColumnNotFound config setting#1938
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…n tests The WHERE path had a bug: line 754 replaced the condition with a ? placeholder before the column lookup, so when the column wasn't found and we logged instead of throwing, the orphaned ? caused a params/where array mismatch downstream. Fix: undo the ? replacement before continuing, letting the raw column name pass through to the database. Also strengthen tests to actually include invalid columns (the original tests only used valid columns, proving nothing about the setting). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wheels caches SQL shells by hashing model name + arguments. The "still throws" test used the same select string as the preceding "skips invalid" test, so it hit the cached SQL (built without the invalid column) and never reached the column validation code. The throws-when-true behavior is already covered by the existing "throws error for invalid select column" test which uses a different select string and runs before any test disables the setting. Co-Authored-By: Claude Opus 4.6 <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.
Summary
throwOnColumnNotFoundconfig setting (defaults totruefor backward compatibility)false,Wheels.ColumnNotFounderrors are downgraded to warnings logged towheels_columnnotfoundinstead of throwing exceptionsshowErrorInformationguard on all 3ColumnNotFoundthrow sites insql.cfcwith the new dedicated settingChanges
vendor/wheels/events/init/orm.cfm-- registersthrowOnColumnNotFound = trueas defaultvendor/wheels/model/sql.cfc-- 3 locations ($orderClause,$createSQLFieldList,$addWhereClauseParameters) now checkthrowOnColumnNotFoundinstead ofshowErrorInformation; when false, logs a warning viawriteLog(). WHERE path also undoes the?placeholder replacement and skips the param to prevent array mismatch crash.vendor/wheels/tests/specs/model/raisedErrorsSpec.cfc-- tests with actual invalid columns: verifies skip when false, verifies throw when truevendor/wheels/tests/specs/model/sqlSpec.cfc-- tests invalid column in select with throwOnColumnNotFound=falseTest plan
Wheels.ColumnNotFoundtests still pass (setting defaults totrue)throwOnColumnNotFound = falsewith actual invalid columnsthrowOnColumnNotFound = true(explicit)wheels_columnnotfoundlog file when setting is false (code review — log I/O not testable across 5 CFML engines in CI)continue+ undo?replacement prevents params/where array mismatch crash🤖 Generated with Claude Code