stephencelis / SQLite.swift

A type-safe, Swift-language layer over SQLite3.
MIT License
9.7k stars 1.56k forks source link

Check if filter value exists #1033

Closed adnanafzal565 closed 3 years ago

adnanafzal565 commented 3 years ago

Hi.

I want to know is there any way I can check if the filter() function returns a record or not ?

nathanfallet commented 3 years ago

@adnanafzal565 Try to execute your query and check how many lines are returned:

let result = try db.prepare(table.filter(yourExpression))
if let _ = result.next() {
    // You have at least one record
}
adnanafzal565 commented 3 years ago

Yes, it was fixed. Thank you.