-
Notifications
You must be signed in to change notification settings - Fork 93
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
Remove the use of the FMDB dependency in SQLiteEventStore (close #823) #840
Conversation
52f6ad8
to
68c84fa
Compare
68c84fa
to
ad68b8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Very nice change
_ = eventStore.removeAllEvents() | ||
XCTAssertEqual(eventStore.count(), 0) | ||
} | ||
|
||
func testSQLiteEventStoreCreateSQLiteFile() { | ||
_ = SQLiteEventStore(namespace: "aNamespace") | ||
let eventStore = createEventStore("aNamespace") | ||
_ = eventStore.count() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this count for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually no longer necessary – I added that because at one time I wanted to initialize the database lazily (only create it on the first database call), but I have later changed my mind and create it during initialization. I have removed this from the tests, thanks for pointing out!
Issue #823
This PR removes the FMDB dependency in favor of accessing the database directly using the
sqlite3
calls. The calls are wrapped in aDatabase
class. Every call uses a new database connection.The
SQLiteEventStore
class wraps theDatabase
class and handles concurrency using a serial dispatch queue. All the calls in theSQLiteEventStore
are synchronous as before.