Skip to content

Commit 6822a87

Browse files
rmanganiellobwikbs
authored andcommitted
[sqflite] New Sqflite Tizen plugin (flutter-tizen#276)
* 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.
1 parent 40ae821 commit 6822a87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+6661
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ The _"non-endorsed"_ status means that the plugin is not endorsed by the origina
3232
| [**sensors_plus_tizen**](packages/sensors_plus) | [sensors_plus](https://github.com/fluttercommunity/plus_plugins/tree/main/packages/sensors_plus) (1st-party) | [![pub package](https://img.shields.io/pub/v/sensors_plus_tizen.svg)](https://pub.dev/packages/sensors_plus_tizen) | No |
3333
| [**share_plus_tizen**](packages/share_plus) | [share_plus](https://github.com/fluttercommunity/plus_plugins/tree/main/packages/share_plus) (1st-party) | [![pub package](https://img.shields.io/pub/v/share_plus_tizen.svg)](https://pub.dev/packages/share_plus_tizen) | No |
3434
| [**shared_preferences_tizen**](packages/shared_preferences) | [shared_preferences](https://github.com/flutter/plugins/tree/master/packages/shared_preferences) (1st-party) | [![pub package](https://img.shields.io/pub/v/shared_preferences_tizen.svg)](https://pub.dev/packages/shared_preferences_tizen) | No |
35+
| [**sqflite_tizen**](packages/sqflite) | [sqflite](https://github.com/tekartik/sqflite) (3rd-party) | [![pub package](https://img.shields.io/pub/v/sqflite_tizen.svg)](https://pub.dev/packages/sqflite_tizen) | No |
3536
| [**tizen_app_control**](packages/tizen_app_control) | (Tizen-only) | [![pub package](https://img.shields.io/pub/v/tizen_app_control.svg)](https://pub.dev/packages/tizen_app_control) | N/A |
3637
| [**url_launcher_tizen**](packages/url_launcher) | [url_launcher](https://github.com/flutter/plugins/tree/master/packages/url_launcher) (1st-party) | [![pub package](https://img.shields.io/pub/v/url_launcher_tizen.svg)](https://pub.dev/packages/url_launcher_tizen) | No |
3738
| [**video_player_tizen**](packages/video_player) | [video_player](https://github.com/flutter/plugins/tree/master/packages/video_player) (1st-party) | [![pub package](https://img.shields.io/pub/v/video_player_tizen.svg)](https://pub.dev/packages/video_player_tizen) | No |
@@ -75,6 +76,7 @@ The following packages are deprecated.
7576
| [**sensors_plus_tizen**](packages/sensors_plus) | ✔️ | ✔️ ||| No sensor hardware |
7677
| [**share_plus_tizen**](packages/share_plus) | ⚠️ | ⚠️ ||| No SMS or e-mail app |
7778
| [**shared_preferences_tizen**](packages/shared_preferences) | ✔️ | ✔️ | ✔️ | ✔️ |
79+
| [**sqflite_tizen**](packages/sqflite) | ✔️ | ✔️ | ✔️ ️| ✔️ |
7880
| [**tizen_app_control**](packages/tizen_app_control) | ✔️ | ✔️ | ✔️ | ✔️ |
7981
| [**url_launcher_tizen**](packages/url_launcher) | ✔️ || ✔️ || No browser app |
8082
| [**video_player_tizen**](packages/video_player) | ✔️ | ✔️ | ⚠️ || Functional limitations (see README)<br>TV emulator issue |

packages/sqflite/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
.dart_tool/
3+
4+
.packages
5+
.pub/
6+
7+
build/

packages/sqflite/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.1.0
2+
3+
* Initial release.

packages/sqflite/LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
BSD 2-Clause License
2+
3+
Copyright (c) 2021, Samsung Electronics Co., Ltd.
4+
Copyright (c) 2021, Renzo Manganiello
5+
Copyright (c) 2019, Tekartik
6+
All rights reserved.
7+
8+
Redistribution and use in source and binary forms, with or without
9+
modification, are permitted provided that the following conditions are met:
10+
11+
* Redistributions of source code must retain the above copyright notice, this
12+
list of conditions and the following disclaimer.
13+
14+
* Redistributions in binary form must reproduce the above copyright notice,
15+
this list of conditions and the following disclaimer in the documentation
16+
and/or other materials provided with the distribution.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

packages/sqflite/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# sqflite_tizen
2+
3+
The Tizen implementation of [`sqflite`](https://github.com/tekartik/sqflite).
4+
5+
## Getting Started
6+
7+
This package is not an _endorsed_ implementation of `sqflite`. Therefore, you have to include `sqflite_tizen` alongside `sqflite` as dependencies in your `pubspec.yaml` file.
8+
9+
```yaml
10+
dependencies:
11+
sqflite: ^2.0.1
12+
sqflite_tizen: ^0.1.0
13+
```
14+
15+
Then you can import `sqflite` in your Dart code:
16+
17+
```dart
18+
import 'package:sqflite/sqflite.dart';
19+
```
20+
21+
For more details, see [here](https://github.com/tekartik/sqflite/blob/master/sqflite/README.md).
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
include: package:flutter_lints/flutter.yaml
2+
3+
# Until there are meta linter rules, each desired lint must be explicitly enabled.
4+
# See: https://github.com/dart-lang/linter/issues/288
5+
#
6+
# For a list of lints, see: http://dart-lang.github.io/linter/lints/
7+
# See the configuration guide for more
8+
# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer
9+
#
10+
# NOTE: Please keep this file in sync with
11+
# https://github.com/flutter/flutter/blob/master/analysis_options.yaml
12+
13+
analyzer:
14+
# Strong mode is sometimes harder to keep
15+
strong-mode:
16+
implicit-casts: false
17+
18+
errors:
19+
# treat missing required parameters as a warning (not a hint)
20+
missing_required_param: warning
21+
# treat missing returns as a warning (not a hint)
22+
missing_return: warning
23+
# allow having TODOs in the code
24+
todo: ignore
25+
# Ignore errors like
26+
# 'super_goes_last' is a deprecated lint rule and should not be used • included_file_warning
27+
included_file_warning: ignore
28+
29+
linter:
30+
rules:
31+
- always_declare_return_types
32+
- avoid_dynamic_calls
33+
- avoid_empty_else
34+
- avoid_relative_lib_imports
35+
- avoid_shadowing_type_parameters
36+
- avoid_slow_async_io
37+
- avoid_types_as_parameter_names
38+
- await_only_futures
39+
- camel_case_extensions
40+
- camel_case_types
41+
- cancel_subscriptions
42+
- curly_braces_in_flow_control_structures
43+
- directives_ordering
44+
- empty_catches
45+
- hash_and_equals
46+
- iterable_contains_unrelated_type
47+
- list_remove_unrelated_type
48+
- no_adjacent_strings_in_list
49+
- no_duplicate_case_values
50+
- non_constant_identifier_names
51+
- omit_local_variable_types
52+
- package_api_docs
53+
- package_prefixed_library_names
54+
- prefer_generic_function_type_aliases
55+
- prefer_is_empty
56+
- prefer_is_not_empty
57+
- prefer_iterable_whereType
58+
- prefer_single_quotes
59+
- prefer_typing_uninitialized_variables
60+
- sort_child_properties_last
61+
- test_types_in_equals
62+
- throw_in_finally
63+
- unawaited_futures
64+
- unnecessary_null_aware_assignments
65+
- unnecessary_statements
66+
- unrelated_type_equality_checks
67+
- unsafe_html
68+
- valid_regexps
69+
70+
- constant_identifier_names
71+
- control_flow_in_finally
72+
- empty_statements
73+
- implementation_imports
74+
- overridden_fields
75+
- package_names
76+
- prefer_const_constructors
77+
- prefer_initializing_formals
78+
- prefer_void_to_null
79+
#
80+
- always_require_non_null_named_parameters
81+
- annotate_overrides
82+
- avoid_init_to_null
83+
- avoid_null_checks_in_equality_operators
84+
- avoid_return_types_on_setters
85+
- empty_constructor_bodies
86+
- library_names
87+
- library_prefixes
88+
- prefer_adjacent_string_concatenation
89+
- prefer_collection_literals
90+
- prefer_contains
91+
- prefer_equal_for_default_values
92+
- slash_for_doc_comments
93+
- type_init_formals
94+
- unnecessary_const
95+
- unnecessary_new
96+
- unnecessary_null_in_if_null_operators
97+
- use_rethrow_when_possible
98+
# === doc rules ===
99+
- public_member_api_docs
100+
#
101+
- prefer_final_locals
102+
- sort_constructors_first
103+
- sort_unnamed_constructors_first

packages/sqflite/example/.gitignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
12+
# IntelliJ related
13+
*.iml
14+
*.ipr
15+
*.iws
16+
.idea/
17+
18+
# The .vscode folder contains launch configuration and tasks you configure in
19+
# VS Code which you may wish to be included in version control, so this line
20+
# is commented out by default.
21+
#.vscode/
22+
23+
# Flutter/Dart/Pub related
24+
**/doc/api/
25+
**/ios/Flutter/.last_build_id
26+
.dart_tool/
27+
.flutter-plugins
28+
.flutter-plugins-dependencies
29+
.packages
30+
.pub-cache/
31+
.pub/
32+
/build/
33+
34+
# Web related
35+
lib/generated_plugin_registrant.dart
36+
37+
# Symbolication related
38+
app.*.symbols
39+
40+
# Obfuscation related
41+
app.*.map.json
42+
43+
# Android Studio will place build artifacts here
44+
/android/app/debug
45+
/android/app/profile
46+
/android/app/release

packages/sqflite/example/LICENSE

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
BSD 2-Clause License
2+
3+
Copyright (c) 2019, Tekartik
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

packages/sqflite/example/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# sqflite_tizen_example
2+
3+
Demonstrates how to use the sqflite_tizen plugin.
4+
5+
## Getting Started
6+
7+
To run this app on your Tizen device, use [flutter-tizen](https://github.com/flutter-tizen/flutter-tizen).
12 KB
Binary file not shown.
24 KB
Binary file not shown.

0 commit comments

Comments
 (0)