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

Commit 4b9419d

Browse files
madalenomythz
authored andcommitted
Fix for OrmLite.Save(). (#630)
* Added support for FireBird 4. Fixed DoesTableExist() that was returning null if table didn't exist. Added support for the new FireBird 4 Identity autoincrement columns. Added some tests for the new FirdBird 4 features. Changed behavior of AutoIncrement fields to use Identity instead of Sequences when using the new FireBird 4 dialect. Work in progress,,,, * Fixed PopulateReturnValues() when the primary key is a Guid (attribute AutoId). It tried to convert the value to an Int64. Fixed PrepareParameterizedInsertStatement() in Firebird4OrmLiteDialectProvider to generate the insert sql with GEN_UUID() for the fields with AutoId attribute when using the FirebirdCompactGuidConverter. Fixed ShouldSkipInsert() in FirebirdOrmLiteDialectProvider to not skip fields with AutoId attribute. Added some tests for models with AutId attributes. * Updated reserved words in FireBird4 dialect provider. Changed the autoincrement definition from "by default" to "always" since there is no easy way to generate the insert sql based on object values. To use "By Default" the generated insert sql should not contain the Id field name if the Id value is null. Updated FirebirdClient package to 6.6.0. Changed obsolete method SelectFmt in Schema.cs. * Fixed OrmLite.Save() that was always returning false when the object already exists in the database. In these cases Save() calls Update() that returns the number of records affected and the return value should check this.
1 parent a8f6b3d commit 4b9419d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ServiceStack.OrmLite/OrmLiteWriteCommandExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,11 +871,11 @@ internal static bool Save<T>(this IDbCommand dbCmd, T obj)
871871
return true;
872872
}
873873

874-
dbCmd.Update(obj);
874+
var rowsUpdated = dbCmd.Update(obj);
875875

876876
modelDef.RowVersion?.SetValueFn(obj, dbCmd.GetRowVersion(modelDef, id, modelDef.RowVersion.ColumnType));
877877

878-
return false;
878+
return rowsUpdated > 0;
879879
}
880880

881881
internal static int SaveAll<T>(this IDbCommand dbCmd, IEnumerable<T> objs)

0 commit comments

Comments
 (0)