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

LIKE operator #133

Closed
dm7sistemas opened this issue Sep 27, 2016 · 4 comments
Closed

LIKE operator #133

dm7sistemas opened this issue Sep 27, 2016 · 4 comments

Comments

@dm7sistemas
Copy link

How I use this example I try but I don't know
I need select using like

    dbverbs = dbQueue.inDatabase { db in
        //db_verbs.filter(Column("basename") == "be%").fetchAll(db)

        //db_verbs.filter(["be"].contains(Column("basename"))).fetchAll(db)
        db_verbs.order(Column("basename").asc, Column("past").asc).fetchAll(db)
    }
@groue
Copy link
Owner

groue commented Sep 27, 2016

Hello @dm7sistemas,

You want to use the LIKE operator of SQLite. And it is missing from GRDB so far: that's why you can't find it in the documentation.

I guess it should be added, yes.

Until then, use a little SQL snippet:

db_verbs
    .filter(sql: "basename LIKE ?", arguments: ["be%"])
    .order(Column("basename"), Column("past"))
    .fetchAll(db)

@groue groue changed the title Select basename from verbs where basename like '%He%' LIKE operator Sep 27, 2016
@dm7sistemas
Copy link
Author

Ok, Thanks for help me. I started using yesterday !!

@groue
Copy link
Owner

groue commented Sep 27, 2016

You're welcome! Happy GRDB!

@groue
Copy link
Owner

groue commented Sep 27, 2016

In next GRDB version, you'll write db_verbs.filter(Column("basename").like("be%"))

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

No branches or pull requests

2 participants