coldbox-modules / quick

A ColdBox ORM Engine
https://quick.ortusbooks.com
MIT License
23 stars 19 forks source link

regression in `reset` behavior, 5.2.0->5.2.7 #208

Open davidAtInleague opened 1 year ago

davidAtInleague commented 1 year ago

The behavior of reset seems to have changed between 5.2.0 -> 5.2.7.

Grammar is mssql.

Repro:

// entity def
component table="RMME_C" extends="quick.models.BaseEntity" accessors=true {
    property name="ID_C" type="numeric" sqltype="integer";

    variables._key = "ID_C";
}

// table
create table rmme_c (id_c int null);

// do it
v = getInstance("RMME_C")

v.whereID_C(42);

sql = v.reset().retrieveQuery().toSql(showBindings=true);

// v5.2.0 (expected)   --> SELECT [RMME_C].[ID_C] FROM [RMME_C]
// v5.2.7 (unexpected) --> SELECT [RMME_C].[ID_C] FROM [RMME_C] WHERE [RMME_C].[ID_C] = {"value":42,"cfsqltype":"integer","null":false}
writedump(sql);
elpete commented 1 year ago

Hmmm...this may just be a docs update needed. Does resetQuery() get you what you'd expect?

davidAtInleague commented 1 year ago

resetQuery does seem to be a substitute for places that were previously using reset -- reset clears at least the select and where lists (and presumably all the other things too but I haven't exhaustively checked).

elpete commented 1 year ago

I would have expected this behavior to have changed in v5 where we split the entity from the builder.

So did this solve your problem?