Why does dataBaseManager.getSQLParameters return object?

Hi,

After doing a controller.loadrecords(sql,args), I tested

dataBaseManager.getSQLParameters(foundset) == args

returned false, while

dataBaseManager.getSQLParameters(foundset).join('|') == args.join('|')

is true.

If you evaluate dataBaseManager.getSQLParameters(foundset) and args, they look identical, like they are arrays. I can see from the docs that dataBaseManager.getSQLParameters(foundset) returns an object.

Why not return an Array?

That Object is a Java Object.

When you start working with it, isn’t it (casted to) a JavaScript Array?

My point is that I’d expect

dataBaseManager.getSQLParameters(foundset) == args

to be true. It isn’t since the SQLParameters is still an object. The casting only happens if you start manipulating the parameters.

I just ant to check if the paramaters are the same as the last time I did the search. i.e. I don’t need to do another search…

I just ant to check if the paramaters are the same as the last time I did the search

Have you tried to compare the objects```
(firstargs == secondargs)

An array-variable is a pointer to an array-object. Comparing two of those vars will only return true if they point to the exact same object, so when they point to two completely different objects that just happen to have the same values, the result will be false.

If you want to compare the values of two array objects you should either loop through them or compare the join’s as you mentioned above.

Apologies, forgot to mention that.
That was basically the reason I suggested to try what result it would give.

OK, I give in.

This is expected behaviour when comparing arrays.