From 4453580cd8a8d02d21971c9d442057933310d6da Mon Sep 17 00:00:00 2001 From: Tobe O Date: Thu, 14 Mar 2019 05:21:53 -0400 Subject: [PATCH] fix insert --- angel_orm/.gitignore | 0 angel_orm/CHANGELOG.md | 6 +++++- angel_orm/LICENSE | 0 angel_orm/README.md | 0 angel_orm/analysis_options.yaml | 0 angel_orm/example/main.angel_serialize.g.part | 0 angel_orm/example/main.dart | 0 angel_orm/example/main.g.dart | 0 angel_orm/example/main.serializer.g.dart | 0 angel_orm/lib/angel_orm.dart | 0 angel_orm/lib/src/annotations.dart | 0 angel_orm/lib/src/builder.dart | 0 angel_orm/lib/src/migration.dart | 0 angel_orm/lib/src/query.dart | 4 +++- angel_orm/lib/src/relations.dart | 0 angel_orm/mono_pkg.yaml | 0 angel_orm/pubspec.yaml | 4 ++-- 17 files changed, 10 insertions(+), 4 deletions(-) mode change 100755 => 100644 angel_orm/.gitignore mode change 100755 => 100644 angel_orm/CHANGELOG.md mode change 100755 => 100644 angel_orm/LICENSE mode change 100755 => 100644 angel_orm/README.md mode change 100755 => 100644 angel_orm/analysis_options.yaml mode change 100755 => 100644 angel_orm/example/main.angel_serialize.g.part mode change 100755 => 100644 angel_orm/example/main.dart mode change 100755 => 100644 angel_orm/example/main.g.dart mode change 100755 => 100644 angel_orm/example/main.serializer.g.dart mode change 100755 => 100644 angel_orm/lib/angel_orm.dart mode change 100755 => 100644 angel_orm/lib/src/annotations.dart mode change 100755 => 100644 angel_orm/lib/src/builder.dart mode change 100755 => 100644 angel_orm/lib/src/migration.dart mode change 100755 => 100644 angel_orm/lib/src/query.dart mode change 100755 => 100644 angel_orm/lib/src/relations.dart mode change 100755 => 100644 angel_orm/mono_pkg.yaml mode change 100755 => 100644 angel_orm/pubspec.yaml diff --git a/angel_orm/.gitignore b/angel_orm/.gitignore old mode 100755 new mode 100644 diff --git a/angel_orm/CHANGELOG.md b/angel_orm/CHANGELOG.md old mode 100755 new mode 100644 index a648fe2f..3d98b591 --- a/angel_orm/CHANGELOG.md +++ b/angel_orm/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.0.0-dev.22 +* `compileInsert` will explicitly never emit a key not belonging to the +associated query. + # 2.0.0-dev.21 * Add tableName to query @@ -97,4 +101,4 @@ crashing on Travis. # 1.0.0-alpha+3 * Added `isIn`, `isNotIn`, `isBetween`, `isNotBetween` to `SqlExpressionBuilder` and its subclasses. -* Added a dependency on `package:meta`. \ No newline at end of file +* Added a dependency on `package:meta`. diff --git a/angel_orm/LICENSE b/angel_orm/LICENSE old mode 100755 new mode 100644 diff --git a/angel_orm/README.md b/angel_orm/README.md old mode 100755 new mode 100644 diff --git a/angel_orm/analysis_options.yaml b/angel_orm/analysis_options.yaml old mode 100755 new mode 100644 diff --git a/angel_orm/example/main.angel_serialize.g.part b/angel_orm/example/main.angel_serialize.g.part old mode 100755 new mode 100644 diff --git a/angel_orm/example/main.dart b/angel_orm/example/main.dart old mode 100755 new mode 100644 diff --git a/angel_orm/example/main.g.dart b/angel_orm/example/main.g.dart old mode 100755 new mode 100644 diff --git a/angel_orm/example/main.serializer.g.dart b/angel_orm/example/main.serializer.g.dart old mode 100755 new mode 100644 diff --git a/angel_orm/lib/angel_orm.dart b/angel_orm/lib/angel_orm.dart old mode 100755 new mode 100644 diff --git a/angel_orm/lib/src/annotations.dart b/angel_orm/lib/src/annotations.dart old mode 100755 new mode 100644 diff --git a/angel_orm/lib/src/builder.dart b/angel_orm/lib/src/builder.dart old mode 100755 new mode 100644 diff --git a/angel_orm/lib/src/migration.dart b/angel_orm/lib/src/migration.dart old mode 100755 new mode 100644 diff --git a/angel_orm/lib/src/query.dart b/angel_orm/lib/src/query.dart old mode 100755 new mode 100644 index b9b18e69..5cbb041b --- a/angel_orm/lib/src/query.dart +++ b/angel_orm/lib/src/query.dart @@ -397,7 +397,9 @@ abstract class QueryValues { } String compileInsert(Query query, String tableName) { - var data = toMap(); + var data = Map.from(toMap()); + var keys = data.keys.toList(); + keys.where((k) => !query.fields.contains(k)).forEach(data.remove); if (data.isEmpty) return null; var fieldSet = data.keys.join(', '); diff --git a/angel_orm/lib/src/relations.dart b/angel_orm/lib/src/relations.dart old mode 100755 new mode 100644 diff --git a/angel_orm/mono_pkg.yaml b/angel_orm/mono_pkg.yaml old mode 100755 new mode 100644 diff --git a/angel_orm/pubspec.yaml b/angel_orm/pubspec.yaml old mode 100755 new mode 100644 index 22efdc03..d6ebe4ff --- a/angel_orm/pubspec.yaml +++ b/angel_orm/pubspec.yaml @@ -1,5 +1,5 @@ name: angel_orm -version: 2.0.0-dev.21 +version: 2.0.0-dev.22 description: Runtime support for Angel's ORM. Includes base classes for queries. author: Tobe O homepage: https://github.com/angel-dart/orm @@ -15,4 +15,4 @@ dev_dependencies: angel_serialize: ^2.0.0 angel_serialize_generator: ^2.0.0 build_runner: ^1.0.0 - test: ^1.0.0 \ No newline at end of file + test: ^1.0.0