the syntax for queryNew is a bit ugly and leads to hard to maintain code due to
the need to maintaining two separate arrays or lists to specify columns and data types
being able to pass in a struct which defines the columns and datatype would be a lot
clearer and easier to maintain
queryNew("name,age","varchar,numeric",[["Susi",20],["Urs",24]]);
vs
queryNew({"name"="varchar","age"="numeric"},[["Susi",20],["Urs",24]]);
i personally never use queryNew to create a populated query, because it is to complicated.
i use the function query instead: qry=query('lastname':['Sorglos','Chlous'],'firstname':['Susi','Sami']);
When you are asking yourself why we have 2 functions doing the same in different ways, the answer is simple.
Compatibility, we added Query with Railo 1.0 long before queryNew had this functionality, then when ACF added this functionality we had to follow.
I get your point, but i PERSONALLY see that function only as a must have and because of that not worth extending it beyond the ACF functionality. If you donât care about compatibility to ACF, use Query.
If you donât care about compatibility to ACF, use Query.
Anyone looking to use the proposed new function signature would be breaking compatibility regardless. The documentation is unsurprisingly terrible for query(), though.