-
Notifications
You must be signed in to change notification settings - Fork 51
[sqflite] New Sqflite Tizen plugin #276
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
Conversation
- Use Namespaces. - Use correct naming for "#define guard". - Use correct naming for "typedef"
Please put periods at the end of log messages whenever possible. |
Other things, looks good to me |
Thanks for all the reviews! Let me know if you see something else @bbrto21 @swift-kim. I can also work on adding the log level support, I can do it in this PR or in a different one, it's up to you |
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.
Just a quick style review.
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) { | ||
LOG_DEBUG("HandleMethodCall: %s", method_call.method_name().c_str()); | ||
const std::string method_name = method_call.method_name(); | ||
if (method_name == sqflite_constants::kMethodOpenDatabase) { |
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.
It's up to your preference but I personally prefer
if (method_name == sqflite_constants::kMethodOpenDatabase) { | |
if (method_name == "openDatabase") { |
in terms of readability.
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.
I'll keep the constants since I think is a good practice to preserve fixed strings in constant variables in case we need to use them somewhere else.
|
I just added Log Level support and apply all style guide changes suggested, thank you for the suggestions! I just figured out there's an issue when opening the |
I managed to reproduce the issue on a mobile 6.0 emulator and here's the stack trace. I haven't looked into the details.
I can tell you how to get this stack trace if you really want. |
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.
Thanks for the quick fix.
@swift-kim I was thinking to create an Issue asking for best practices to debug Tizen plugins. I'll create it tomorrow, it'll be useful for other contributors as well. |
@rmanganiello The current best practice is just to use logs :D I'm currently writing https://github.com/flutter-tizen/flutter-tizen/wiki/Debugging-and-profiling-the-engine#debugging-with-lldb and it will give you some useful information. You can use either a wearable or mobile emulator, and should download the |
Thanks, this is really useful! I'll give it a try and see if I can fix this issue, it seems related with a bad pointer while trying to destroy the Database instance. |
- Add mutex protection to static variables in SqflitePlugin such as `database_id_`, `database_map_` and `single_instances_by_path_`. - Remove usages of `DatabaseManager::Init` since it shuts down the database and invalidate stored Databases between executions.
Just fixed the issue @bbrto21 and @swift-kim, I was shutting down sqlite each time a new Database instance was created and it seems that corrupted previous stored connections. I also added a Please take a look and thanks for the patience |
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. Thank you for your hard work!
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
published |
* WIP * Remove unused folder * Rename test * Add update/insert/query functionalities * Fix static variables and onDelete * Start throwing exceptions in DatabaseManager * Make batch operations work * Fix batch call * Fix OnOpenDatabaseCall and open readOnly database * RAII for db, support blobs/lists and simplify code * Handle query exceptions correctly * Handle empty resultset response while querying * Fix no-rowid tests for tizen * Remove usages of deprecated `debugModeOn` in raw_test_page * Use correct error for open failed exception * Add assets to test from asset db * Fix more tests and change open sub folder test to fail * Fix exp tests * Simplify code * Create constants * Fix manual tests and add OnDebugCall support * Check for allowed permissions properly * Remove `using` * Apply `expect` implementation fix from sqflite * Update README * Update README * Update README.md * Remove unneded tests * Remove unneded example project dependencies * Remove test_driver folder * Remove unneded files and variables * Add new line EOF * Fix manifest and remove useless folder * Add new lines at EOF * Add new line at EOF * Cleanup code * Use constant * Add SQFlite LICENSE for example project * Move to MINOR version * Add integration tests * Fix Dart issues * Add sqflite to recipe.yaml for integration tests * Remove permission check for mediastorage This permission is not needed to run the application since we store databases in the internal app directory and not in the mediastorage * Set sqlite3_busy_timeout and add tv target * Apply Style guide * Convert to snake_case * Move static members to end of class * Remove unneded methods * Remove deprecated constant and move struct out of class * Apply more style guide rules - Use Namespaces. - Use correct naming for "#define guard". - Use correct naming for "typedef" * Remove logs, fix licenses and apply suggested comments * Add log_level support and style guide changes * Fix variables naming database manager header * Fix database_manager header private variables order * Remove unused imports * Include `mutex` support and fix DatabaseManager - Add mutex protection to static variables in SqflitePlugin such as `database_id_`, `database_map_` and `single_instances_by_path_`. - Remove usages of `DatabaseManager::Init` since it shuts down the database and invalidate stored Databases between executions.
Sqflite Tizen plugin
Hey there 👋🏼 ! Here's an implementation of the SQFlite plugin I've been working on for Tizen!
I've been working on this for about ~2 months now and I'm happy to say that I have something functional! (there are some caveats to consider though).
Also, it's important to say that this is my first ever C++ project, I was learning the language while working on this so you'll probably find things to improve in the implementation, any feedback is welcomed!
How it works
I based the implementation on the Sqflite plugin written for Android, all the interfaces are respected which means that this is (almost) fully compatible with SQFlite plugin.
Functionalities
Caveats