Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 94a2424

Browse files
committed
Update to Npgsql v4.0.1
1 parent a8dc9c1 commit 94a2424

File tree

7 files changed

+14
-15
lines changed

7 files changed

+14
-15
lines changed

NuGet/ServiceStack.OrmLite.PostgreSQL.Core/servicestack.ormlite.postgresql.core.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<copyright>ServiceStack and contributors</copyright>
1919
<dependencies>
2020
<group targetFramework=".netstandard2.0">
21-
<dependency id="Npgsql" version="[3.2.7, )" />
21+
<dependency id="Npgsql" version="[4.0.1, )" />
2222
<dependency id="ServiceStack.OrmLite.Core" version="5.0.0" />
2323
</group>
2424
</dependencies>

NuGet/ServiceStack.OrmLite.PostgreSQL/servicestack.ormlite.postgresql.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
<copyright>ServiceStack and contributors</copyright>
2020
<dependencies>
2121
<group targetFramework="net45">
22-
<dependency id="Npgsql" version="[3.2.7, )" />
22+
<dependency id="Npgsql" version="[4.0.1, )" />
2323
<dependency id="ServiceStack.OrmLite" version="5.0.0" />
2424
</group>
2525
<group targetFramework=".netstandard2.0">
26-
<dependency id="Npgsql" version="[3.2.7, )" />
26+
<dependency id="Npgsql" version="[4.0.1, )" />
2727
<dependency id="ServiceStack.OrmLite" version="5.0.0" />
2828
</group>
2929
</dependencies>

src/ServiceStack.OrmLite.PostgreSQL.Tests/ServiceStack.OrmLite.PostgreSQL.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
2727
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0-preview-20180610-02" />
2828
<PackageReference Include="NUnit" Version="3.10.1" />
29-
<PackageReference Include="Npgsql" Version="4.0.0" />
29+
<PackageReference Include="Npgsql" Version="4.0.1" />
3030
</ItemGroup>
3131

3232
<PropertyGroup Condition=" '$(TargetFramework)' == 'net46' ">

src/ServiceStack.OrmLite.PostgreSQL/PostgreSQLDialectProvider.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,17 +256,19 @@ public override void PrepareParameterizedInsertStatement<T>(IDbCommand cmd, ICol
256256

257257
foreach (var fieldDef in modelDef.FieldDefinitionsArray)
258258
{
259-
if (ShouldReturnOnInsert(modelDef, fieldDef))
259+
//insertFields contains Property "Name" of fields to insert
260+
var includeField = insertFields == null || insertFields.Contains(fieldDef.Name, StringComparer.OrdinalIgnoreCase);
261+
262+
if (ShouldReturnOnInsert(modelDef, fieldDef) && (!fieldDef.AutoId || !includeField))
260263
{
261-
sbReturningColumns.Append(sbReturningColumns.Length == 0 ? "RETURNING " : ",");
264+
sbReturningColumns.Append(sbReturningColumns.Length == 0 ? " RETURNING " : ",");
262265
sbReturningColumns.Append(GetQuotedColumnName(fieldDef.FieldName));
263266
}
264267

265-
if (ShouldSkipInsert(fieldDef))
268+
if (ShouldSkipInsert(fieldDef) && (!fieldDef.AutoId || !includeField))
266269
continue;
267270

268-
//insertFields contains Property "Name" of fields to insert ( that's how expressions work )
269-
if (insertFields != null && !insertFields.Contains(fieldDef.Name, StringComparer.OrdinalIgnoreCase))
271+
if (!includeField)
270272
continue;
271273

272274
if (sbColumnNames.Length > 0)

src/ServiceStack.OrmLite.PostgreSQL/ServiceStack.OrmLite.PostgreSQL.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</PropertyGroup>
2222

2323
<ItemGroup>
24-
<PackageReference Include="Npgsql" Version="4.0.0" />
24+
<PackageReference Include="Npgsql" Version="4.0.1" />
2525
</ItemGroup>
2626

2727
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">

src/ServiceStack.OrmLite/OrmLiteUtils.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -971,9 +971,6 @@ public static List<string> GetNonDefaultValueInsertFields<T>(this IOrmLiteDialec
971971
{
972972
if (!string.IsNullOrEmpty(dialectProvider.GetDefaultValue(fieldDef)))
973973
{
974-
if (fieldDef.AutoId)
975-
continue;
976-
977974
var value = fieldDef.GetValue(obj);
978975
if (value == null || value.Equals(fieldDef.FieldTypeDefaultValue))
979976
continue;

tests/ServiceStack.OrmLite.Tests/MaxDataTypeTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ public class MaxDataTypeTests : OrmLiteTestBase
1010
[Test]
1111
public void Can_insert_and_select_max_values()
1212
{
13-
//OrmLiteConfig.ThrowOnError = true;
13+
OrmLiteConfig.ThrowOnError = true;
1414
var isSqlServer = (Dialect & Dialect.AnySqlServer) == Dialect;
1515

1616
var model = new ModelWithFieldsOfDifferentTypes
1717
{
1818
Int = int.MaxValue,
1919
Long = long.MaxValue,
2020
Double = double.MaxValue,
21-
Decimal = !isSqlServer && Dialect != Dialect.Sqlite
21+
Decimal = !isSqlServer && Dialect != Dialect.Sqlite && Dialect != Dialect.PostgreSql
2222
? Decimal.MaxValue
2323
: long.MaxValue,
2424
DateTime = Dialect != Dialect.MySql

0 commit comments

Comments
 (0)