qb
qb copied to clipboard
qb is ignoring duplicate field names
qb should fail when you define duplicate field names, but it is ignoring themsee this code
var myArray = _qbMySite4u().from("equipment equ")
.join( "racks rck", "rck.id", "=", "equ.rack_FK")
.select("equ.id,equ.name,equ.height,equ.rackPosition,rck.id,rck.name")
This wil return an array of structs, but with only four struct keys instead of 6. Actually it should fail because both equipment and rack have id and name fields, but I forgot to alias them. Should fail, but it is silenty ignoring the offending duplicate names.
.select("equ.id,equ.name,equ.height,equ.rackPosition,rck.id as rackId,rck.name as rackName")
This solves the problem. In SQL this would also fail without aliases I guess.