You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/src/wheels/model/sql.cfc
+46-18Lines changed: 46 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -274,12 +274,20 @@ component {
274
274
}
275
275
}
276
276
}
277
-
if (application.wheels.showErrorInformation&&!Len(local.toAdd)) {
278
-
Throw(
279
-
type ="Wheels.ColumnNotFound",
280
-
message ="Wheels looked for the column mapped to the `#local.property#` property but couldn't find it in the database table.",
281
-
extendedInfo ="Verify the `order` argument and/or your property to column mappings done with the `property` method inside the model's `config` method to make sure everything is correct."
282
-
);
277
+
if (!Len(local.toAdd)) {
278
+
if (application.wheels.throwOnColumnNotFound) {
279
+
Throw(
280
+
type ="Wheels.ColumnNotFound",
281
+
message ="Wheels looked for the column mapped to the `#local.property#` property but couldn't find it in the database table.",
282
+
extendedInfo ="Verify the `order` argument and/or your property to column mappings done with the `property` method inside the model's `config` method to make sure everything is correct."
283
+
);
284
+
} else {
285
+
writeLog(
286
+
text ="ColumnNotFound: column mapped to `#local.property#` not found in database table (order clause). Set throwOnColumnNotFound=true to throw an exception.",
287
+
type ="warning",
288
+
file ="wheels_columnnotfound"
289
+
);
290
+
}
283
291
}
284
292
}
285
293
}
@@ -527,12 +535,20 @@ component {
527
535
Added an exception in case the column specified in the select or group argument does not exist in the database.
528
536
This will only be in case when not using "table.column" or "column AS something" since in those cases Wheels passes through the select clause unchanged.
529
537
*/
530
-
if (application.wheels.showErrorInformation&&!Len(local.toAppend) &&arguments.clause=="select"&&ListFindNoCase(local.addedPropertiesByModel[local.associationKey], local.iItem) EQ0) {
531
-
Throw(
532
-
type ="Wheels.ColumnNotFound",
533
-
message ="Wheels looked for the column mapped to the `#local.iItem#` property but couldn't find it in the database table.",
534
-
extendedInfo ="Verify the `#arguments.clause#` argument and/or your property to column mappings done with the `property` method inside the model's `config` method to make sure everything is correct."
535
-
);
538
+
if (!Len(local.toAppend) &&arguments.clause=="select"&&ListFindNoCase(local.addedPropertiesByModel[local.associationKey], local.iItem) EQ0) {
539
+
if (application.wheels.throwOnColumnNotFound) {
540
+
Throw(
541
+
type ="Wheels.ColumnNotFound",
542
+
message ="Wheels looked for the column mapped to the `#local.iItem#` property but couldn't find it in the database table.",
543
+
extendedInfo ="Verify the `#arguments.clause#` argument and/or your property to column mappings done with the `property` method inside the model's `config` method to make sure everything is correct."
544
+
);
545
+
} else {
546
+
writeLog(
547
+
text ="ColumnNotFound: column mapped to `#local.iItem#` not found in database table (#arguments.clause# clause). Set throwOnColumnNotFound=true to throw an exception.",
548
+
type ="warning",
549
+
file ="wheels_columnnotfound"
550
+
);
551
+
}
536
552
}
537
553
538
554
if (Len(local.toAppend)) {
@@ -762,12 +778,24 @@ component {
762
778
}
763
779
}
764
780
}
765
-
if (application.wheels.showErrorInformation&&!StructKeyExists(local.param, "column")) {
766
-
Throw(
767
-
type ="Wheels.ColumnNotFound",
768
-
message ="Wheels looked for the column mapped to the `#local.param.property#` property but couldn't find it in the database table.",
769
-
extendedInfo ="Verify the `where` argument and/or your property to column mappings done with the `property` method inside the model's `config` method to make sure everything is correct."
770
-
);
781
+
if (!StructKeyExists(local.param, "column")) {
782
+
if (application.wheels.throwOnColumnNotFound) {
783
+
Throw(
784
+
type ="Wheels.ColumnNotFound",
785
+
message ="Wheels looked for the column mapped to the `#local.param.property#` property but couldn't find it in the database table.",
786
+
extendedInfo ="Verify the `where` argument and/or your property to column mappings done with the `property` method inside the model's `config` method to make sure everything is correct."
787
+
);
788
+
} else {
789
+
writeLog(
790
+
text ="ColumnNotFound: column mapped to `#local.param.property#` not found in database table (where clause). Set throwOnColumnNotFound=true to throw an exception.",
791
+
type ="warning",
792
+
file ="wheels_columnnotfound"
793
+
);
794
+
// Undo the ? replacement so where/params arrays stay in sync.
795
+
// The raw column name passes through to the database as-is.
0 commit comments