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

[MC-2082] Implement new event storage #380

Open
wants to merge 3 commits into
base: feature_multi_triggers
Choose a base branch
from

Conversation

nishant-clevertap
Copy link
Contributor

Overview

We need to implement new events storage that is persisted across sessions and on user switches. We have used SQLite to store data based on our requirement and it is also light weighted.

Implementation

Created class CTEventDatabase which will handle storing of user events data in table CTUserEventLogs. The schema used is as - eventName, count, firstTs, lastTs, deviceID where eventName and deviceID combined is used as primary key. We have added methods to create table, insert data, update data, check if event exists or not, and to get count, first and last time stamp of event for particular deviceID. Added unit tests also for these methods.

- Added new class CTEventDatabase to store user events in database.
- Added create table, insert, update and check event methods.
@akashvercetti
Copy link
Collaborator

@nishant-clevertap i have some suggestions.
1.createTable hasn't been called anywhere, should we call it in initWithConfig at the start?
2. should we use database schema version for future db migrations?
3. for the insert and update queries, can we use sqlite3_bind_text and sqlite3_bind_int instead of NSString.
4. can we check if (!_eventDatabase) before every operation begins for safety
5. can dispatch_sync cause deadlocks or hangs? should we use something else?

@nzagorchev any suggestions?

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