Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

IgnoreCase problem #47

Open
AlexBaranowski opened this issue Jan 23, 2017 · 4 comments
Open

IgnoreCase problem #47

AlexBaranowski opened this issue Jan 23, 2017 · 4 comments

Comments

@AlexBaranowski
Copy link

deal.getInstrument().getName().toLowerCase().equals(instrumentNameLowerCase)
is working greatly
Unfortunately
deal.getInstrument().getName().equalsIgnoreCase(instrumentName) is not working as expected.

Is it possible to map that equaslsIgnoreCase match SQL UPPER (string1) UPPER(string2) or same thing for lower?

@my2iu
Copy link
Owner

my2iu commented Jan 23, 2017

I'm a little hesitant to do that because when you do operations like that on a database, it results in very bad performance since the database needs to scan the entire database to find the result. By not making the equalsIgnoreCase() method available, Jinq encourages people to do something more efficient.

I'll think about it, but since there's a work-around (just use toUpperCase()), I won't prioritize fixing this.

@karolhad
Copy link

Why deal.getInstrument().getName().equalsIgnoreCase(instrumentName) is not translated to exactly the same SQL query as deal.getInstrument().getName().toLowerCase().equals(instrumentName.toLowerCase())?

@my2iu
Copy link
Owner

my2iu commented Jan 25, 2017

That's how I would translate it. That's also really, really slow because the database needs to read the whole hard disk of data to execute it. I don't want people to accidentally do that, so that's why I don't want to provide a method for that.

@karolhad
Copy link

Ok, understand so maybe a good idea is to add some kind of warning if someone wants to execute methods like toLowerCase() or toUpperCase() on a column. My point is that if someone accidentally writes deal.getInstrument().getName().toLowerCase() DB will need to read all data from disk.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants