Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Boolean Fields Aren't Returned Boolean Types #203

Closed
aejnsn opened this issue Apr 3, 2014 · 6 comments
Closed

Boolean Fields Aren't Returned Boolean Types #203

aejnsn opened this issue Apr 3, 2014 · 6 comments

Comments

@aejnsn
Copy link

aejnsn commented Apr 3, 2014

This works as intended:

return new Select()
            .from(Score.class)
            .where("valid = ?", 1)
            .execute();

This does not work as intended:

return new Select()
            .from(Score.class)
            .where("valid = ?", true)
            .execute();

My model looks like this:

public class Score extends Model
{
    @Column(name = "dateTime")
    public Date dateTime;

    @Column(name = "batteryLevel")
    public double batteryLevel;

    @Column(name = "value")
    public int value;

    @Column(name = "valid")
    public boolean valid;
}

If I had more time outside of the project I'm working on, I'd look into the code more and submit a PR to change this bit. Can someone confirm this is an issue or comment if I am missing something?

Thanks!

@joshuapinter
Copy link
Contributor

Instead of doing .execute() can you do .toSql() and post the output here.

@aejnsn
Copy link
Author

aejnsn commented Apr 3, 2014

Alright. This is the returned string.

SELECT * FROM Score WHERE valid = ?

@joshuapinter
Copy link
Contributor

K, thanks. I'll take a look at this today.

In the meantime, best to use 0 and 1.

@aejnsn
Copy link
Author

aejnsn commented Apr 3, 2014

Awesome thanks!

joshuapinter added a commit to joshuapinter/ActiveAndroid that referenced this issue Apr 6, 2014
This works:

	.where("booleanField = ?", 0)

This doesn't work:

	.where("booleanField = ?", false)
joshuapinter added a commit to joshuapinter/ActiveAndroid that referenced this issue Apr 6, 2014
This works:

	.where("booleanField = ?", 0)

This doesn't work:

	.where("booleanField = ?", false)
joshuapinter added a commit to joshuapinter/ActiveAndroid that referenced this issue Apr 6, 2014
@joshuapinter
Copy link
Contributor

@aejnsn This is fixed with the attached commits. Just waiting for @SeanPONeil to merge in the pull request.

@aejnsn
Copy link
Author

aejnsn commented Apr 11, 2014

Good work, sir. Thank you!

@aejnsn aejnsn closed this as completed Apr 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants