| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| 10 | 10 | ### Added | |
| 11 | 11 | - `SQLiteDatabase#insertOrThrow()` method | |
| 12 | 12 | - `SQLiteDatabase#insertWithOnConflict()` method | |
| 13 | + - `SQLiteDatabase#replaceOrThrow()` method | ||
| 13 | 14 | ||
| 14 | 15 | ## [0.2.3] - 2018-12-04 | |
| 15 | 16 | ### Added | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -150,6 +150,7 @@ Reference | |||
| 150 | 150 | - [`SQLiteDatabase#query()`](https://pub.dartlang.org/documentation/flutter_sqlcipher/latest/sqlite/SQLiteDatabase/query.html) | |
| 151 | 151 | - [`SQLiteDatabase#rawQuery()`](https://pub.dartlang.org/documentation/flutter_sqlcipher/latest/sqlite/SQLiteDatabase/rawQuery.html) | |
| 152 | 152 | - [`SQLiteDatabase#replace()`](https://pub.dartlang.org/documentation/flutter_sqlcipher/latest/sqlite/SQLiteDatabase/replace.html) | |
| 153 | + - [`SQLiteDatabase#replaceOrThrow()`](https://pub.dartlang.org/documentation/flutter_sqlcipher/latest/sqlite/SQLiteDatabase/replaceOrThrow.html) | ||
| 153 | 154 | - [`SQLiteDatabase#setForeignKeyConstraintsEnabled()`](https://pub.dartlang.org/documentation/flutter_sqlcipher/latest/sqlite/SQLiteDatabase/setForeignKeyConstraintsEnabled.html) | |
| 154 | 155 | - [`SQLiteDatabase#setLocale()`](https://pub.dartlang.org/documentation/flutter_sqlcipher/latest/sqlite/SQLiteDatabase/setLocale.html) | |
| 155 | 156 | - [`SQLiteDatabase#setMaxSqlCacheSize()`](https://pub.dartlang.org/documentation/flutter_sqlcipher/latest/sqlite/SQLiteDatabase/setMaxSqlCacheSize.html) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -280,6 +280,14 @@ class SQLiteDatabaseMethodHandler implements MethodCallHandler { | |||
| 280 | 280 | break; | |
| 281 | 281 | } | |
| 282 | 282 | ||
| 283 | + case "replaceOrThrow": { | ||
| 284 | + final SQLiteDatabase db = this.getDatabaseArgument(call); | ||
| 285 | + final String table = getRequiredArgument(call, "table"); | ||
| 286 | + final Map<String, Object> values = getRequiredArgument(call, "values"); | ||
| 287 | + result.success(db.replaceOrThrow(table, null, convertMapToContentValues(values))); | ||
| 288 | + break; | ||
| 289 | + } | ||
| 290 | + | ||
| 283 | 291 | case "setForeignKeyConstraintsEnabled": { | |
| 284 | 292 | final SQLiteDatabase db = this.getDatabaseArgument(call); | |
| 285 | 293 | final boolean enable = getRequiredArgument(call, "enable"); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -449,7 +449,22 @@ abstract class SQLiteDatabase implements SQLiteClosable { | |||
| 449 | 449 | return _channel.invokeMethod('replace', request); | |
| 450 | 450 | } | |
| 451 | 451 | ||
| 452 | - // TODO: https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase#replaceOrThrow(java.lang.String,%20java.lang.String,%20android.content.ContentValues) | ||
| 452 | + /// Convenience method for replacing a row in the database. | ||
| 453 | + /// | ||
| 454 | + /// Inserts a new row if a row does not already exist. | ||
| 455 | + /// | ||
| 456 | + /// See: https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase#replaceOrThrow(java.lang.String,%20java.lang.String,%20android.content.ContentValues) | ||
| 457 | + Future<int> replaceOrThrow({ | ||
| 458 | + @required final String table, | ||
| 459 | + @required final Map<String, dynamic> values, | ||
| 460 | + }) { | ||
| 461 | + final Map<String, dynamic> request = <String, dynamic>{ | ||
| 462 | + 'id': id, | ||
| 463 | + 'table': table, | ||
| 464 | + 'values': values, | ||
| 465 | + }; | ||
| 466 | + return _channel.invokeMethod('replaceOrThrow', request); | ||
| 467 | + } | ||
| 453 | 468 | ||
| 454 | 469 | /// Sets whether foreign key constraints are enabled for the database. | |
| 455 | 470 | /// | |
| Back | FazBrowse Home | New Git URL |
0 commit comments