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: vendor/wheels/model/sql.cfc
+46-18Lines changed: 46 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -279,12 +279,20 @@ component {
279
279
}
280
280
}
281
281
}
282
-
if (application.wheels.showErrorInformation&&!Len(local.toAdd)) {
283
-
Throw(
284
-
type ="Wheels.ColumnNotFound",
285
-
message ="Wheels looked for the column mapped to the `#local.property#` property but couldn't find it in the database table.",
286
-
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."
287
-
);
282
+
if (!Len(local.toAdd)) {
283
+
if (application.wheels.throwOnColumnNotFound) {
284
+
Throw(
285
+
type ="Wheels.ColumnNotFound",
286
+
message ="Wheels looked for the column mapped to the `#local.property#` property but couldn't find it in the database table.",
287
+
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."
288
+
);
289
+
} else {
290
+
writeLog(
291
+
text ="ColumnNotFound: column mapped to `#local.property#` not found in database table (order clause). Set throwOnColumnNotFound=true to throw an exception.",
292
+
type ="warning",
293
+
file ="wheels_columnnotfound"
294
+
);
295
+
}
288
296
}
289
297
}
290
298
}
@@ -532,12 +540,20 @@ component {
532
540
Added an exception in case the column specified in the select or group argument does not exist in the database.
533
541
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.
534
542
*/
535
-
if (application.wheels.showErrorInformation&&!Len(local.toAppend) &&arguments.clause=="select"&&ListFindNoCase(local.addedPropertiesByModel[local.associationKey], local.iItem) EQ0) {
536
-
Throw(
537
-
type ="Wheels.ColumnNotFound",
538
-
message ="Wheels looked for the column mapped to the `#local.iItem#` property but couldn't find it in the database table.",
539
-
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."
540
-
);
543
+
if (!Len(local.toAppend) &&arguments.clause=="select"&&ListFindNoCase(local.addedPropertiesByModel[local.associationKey], local.iItem) EQ0) {
544
+
if (application.wheels.throwOnColumnNotFound) {
545
+
Throw(
546
+
type ="Wheels.ColumnNotFound",
547
+
message ="Wheels looked for the column mapped to the `#local.iItem#` property but couldn't find it in the database table.",
548
+
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."
549
+
);
550
+
} else {
551
+
writeLog(
552
+
text ="ColumnNotFound: column mapped to `#local.iItem#` not found in database table (#arguments.clause# clause). Set throwOnColumnNotFound=true to throw an exception.",
553
+
type ="warning",
554
+
file ="wheels_columnnotfound"
555
+
);
556
+
}
541
557
}
542
558
543
559
if (Len(local.toAppend)) {
@@ -767,12 +783,24 @@ component {
767
783
}
768
784
}
769
785
}
770
-
if (application.wheels.showErrorInformation&&!StructKeyExists(local.param, "column")) {
771
-
Throw(
772
-
type ="Wheels.ColumnNotFound",
773
-
message ="Wheels looked for the column mapped to the `#local.param.property#` property but couldn't find it in the database table.",
774
-
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."
775
-
);
786
+
if (!StructKeyExists(local.param, "column")) {
787
+
if (application.wheels.throwOnColumnNotFound) {
788
+
Throw(
789
+
type ="Wheels.ColumnNotFound",
790
+
message ="Wheels looked for the column mapped to the `#local.param.property#` property but couldn't find it in the database table.",
791
+
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."
792
+
);
793
+
} else {
794
+
writeLog(
795
+
text ="ColumnNotFound: column mapped to `#local.param.property#` not found in database table (where clause). Set throwOnColumnNotFound=true to throw an exception.",
796
+
type ="warning",
797
+
file ="wheels_columnnotfound"
798
+
);
799
+
// Undo the ? replacement so where/params arrays stay in sync.
800
+
// The raw column name passes through to the database as-is.
0 commit comments