Ookma-Kyi
09/13/2022, 7:28 PMIncorrect integer value: 'true' for column 'notifications' at row 1
. Inspecting my database it shows my column is a tinyint. Doing some research MySQL does not have support for true Booleans, however it does support true, false, True, False, TRUE, FALSE
values which is what I am doing. Is there something going on behind the scenes?
Source: https://www.mysqltutorial.org/mysql-boolean/Erik Jespersen
09/13/2022, 7:31 PMErik Jespersen
09/13/2022, 7:31 PMOokma-Kyi
09/13/2022, 7:31 PMvar user = getInstance( "User" )
.firstWhere( "id", auth.user().getId() ?: -1 )
.setNotifications( true )
.save();
Erik Jespersen
09/13/2022, 7:34 PMErik Jespersen
09/13/2022, 7:34 PMErik Jespersen
09/13/2022, 7:35 PMOokma-Kyi
09/13/2022, 7:36 PMtrue
and false
and it doesn't is beyond me.Ookma-Kyi
09/13/2022, 7:36 PMErik Jespersen
09/13/2022, 7:38 PMErik Jespersen
09/13/2022, 7:38 PMseancorfield
BIT(1)
fields which is what we use for representing Booleans -- but both ACF and Lucee seem to translate this to 0/1 on read and for whatever weird reason require 0/1 on write as well. It's bonkers. CFML has a very warped view of Boolean, unfortunately.Adam Cameron
'true'
(a string) not true
(a boolean literal). Are you sure whatever DB-abstraction library you are using isn't somehow deciding .setNotifications( true )
should be using the string "true"
? Seems unlikely, that said.
BTW you describe this as "regular CFML":
var user = getInstance( "User" )
.firstWhere( "id", auth.user().getId() ?: -1 )
.setNotifications( true )
.save();
That is some DB abstraction library in play. It's not "regular CFML" (which would just be a queryExecute
call).
They error should emit the exact SQL that was rejected by the DB... would be helpful to post that.seancorfield
qb
or maybe ORMBox (at first I thought cfWheels but that's all getModel()
nonsense isn't it?)Adam Cameron
seancorfield
Adam Cameron
getModel
is far too much "good naming" for CFWheels. In CFWheels it's just model
(which I guess is also a verb so could be construed as a method name I guess, but then one sees the equivalent function controller
and realise it's just bad naming).