qb is changing my string input to a number.

Description

If an insert/update has a string value which looks like a number, qb is changing it to numeric in inferSQLtype() in queryUtils. This is quite nasty with LARGE numbers, because lucee is rounding them e.g
"1234567" will become something like 1.2345e+006"". This way some things like long registration code will be lost, and lucee will happily insert incorrect values in your db without complaining.
code sample
/**queryExecute(
"insert into autodnshistoryitems(id,created,code,owneruser,type)
values(:id,:name,:created,:code,:action,:status,:ownerContext,:owneruser,:type)",
{
id=item.id,
Created={ value=item.created, cfsqltype = "CF_SQL_TIMESTAMP"} ,
Code=item.function_code,
OwnerUser={ value=item.owner.user, cfsqltype = "CF_SQL_VARCHAR" },
Type=item.type
}
)**/
_qbmysite4u().from("autodnshistoryitems")
.insert(
{
id=item.id,
Created={ value=item.created, cfsqltype = "CF_SQL_TIMESTAMP"} ,
Code=item.function_code,
// OwnerUser={ value=item.owner.user, cfsqltype = "CF_SQL_VARCHAR" },
OwnerUser= item.owner.user,
Type=item.type
}
)
This code will insert correct values in queryexecute, but incorrect in qb, because qb is defining sqltype as cf_SQL_NUMERIC automatically

Environment

None

Status

Assignee

Eric Peterson

Reporter

Wil de Bruin

Labels

None

Priority

Major
Configure