question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug using Enum inside Where condition

See original GitHub issue

DBFlow Version: develop-SNAPSHOT Issue Kind (Bug, Question, Feature): Bug

Description: SQLite.select().from(Bonus.class).where(Bonus_Table.market.eq(Market.CERT_X)).queryList();

android.database.sqlite.SQLiteException: no such column: CERT_X (code 1): , while compiling: SELECT * FROM BonusWHEREmarket=CERT_X ORDER BY underlyingName ASC

i think SELECT should be:

SELECT * FROM BonusWHEREask!=0.0 AND market='CERT_X' ORDER BY underlyingName ASC

with this converter works

public class CustomConverter extends TypeConverter<String, Market> {
	@Override
	public String getDBValue(Market model) {
		return model.name();
	}

	@Override
	public Market getModelValue(String data) {
		return Market.valueOf(data);
	}
}

this workaround works for “eq” but not for “in”

“in” seams not use converter

same converter produce this select that works

SELECT * FROM BonusWHEREask!=0.0 AND (typeBarrier='CONTINUA' OR typeBarrier='DISCRETA') ORDER BY underlyingName ASC

and this that not works

SELECT * FROM BonusWHEREask!=0.0 AND typeBarrierIN (DISCRETA,CONTINUA) ORDER BYunderlyingNameASC

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
agrosnercommented, Nov 7, 2016

in develop.

1reaction
trevjonezcommented, Nov 4, 2016

There are some big changes with how type converters work in V4. These issues are likely related.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Strange java enum bug - Stack Overflow
I've debugged the above code, and ans.getStatus() returns AnswerStatus.ASSESSED. Still, the if line returns true, and assessed is set to false.
Read more >
EF Core 3.1 beta - Error casting Enum inside Where Clause
After migrating to Oracle EF Core 3.19.0-beta I'm getting an error when casting an enum inside a Where clause:
Read more >
enum scope generates wrong SQL WHERE condition when ...
Currently, it is just assumed that the enum DB column only contains enum values and it is always possible to query the DB...
Read more >
guarding on enum value | Apple Developer Forums
I am attepting to guard depending on the value of an enum... This is a contrived example so bear with me... public struct...
Read more >
Enumeration with sequential values has its for-loop exit ...
So I've entered this as a different bug for reconsideration about how the compiler is handling valid enumeration values in -O2.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found