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

Remove the use of the FMDB dependency in SQLiteEventStore (close #823) #840

Merged
merged 7 commits into from
Oct 17, 2023

Conversation

matus-tomlein
Copy link
Contributor

Issue #823

This PR removes the FMDB dependency in favor of accessing the database directly using the sqlite3 calls. The calls are wrapped in a Database class. Every call uses a new database connection.

The SQLiteEventStore class wraps the Database class and handles concurrency using a serial dispatch queue. All the calls in the SQLiteEventStore are synchronous as before.

@matus-tomlein matus-tomlein marked this pull request as ready for review October 10, 2023 14:58
Copy link
Contributor

@mscwilson mscwilson left a 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()
Copy link
Contributor

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?

Copy link
Contributor Author

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!

@matus-tomlein matus-tomlein merged commit f7aadb1 into release/6.0.0 Oct 17, 2023
10 checks passed
@matus-tomlein matus-tomlein deleted the issue/823-remove_fmdb branch October 17, 2023 05:54
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

Successfully merging this pull request may close these issues.

2 participants