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

Commit 0a24957

Browse files
thangtxmythz
authored andcommitted
Fix bug can't insert data with sequence (#631)
1 parent 742ee2f commit 0a24957

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ServiceStack.OrmLite.Oracle/OracleOrmLiteDialectProvider.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,10 +850,13 @@ private object GetNextValue(IDbCommand dbCmd, string sequence, object value)
850850
}
851851
return retObj;
852852
}
853-
853+
//Get current CommandText
854+
var lastSql = dbCmd.CommandText;
854855
dbCmd.CommandText = $"SELECT {Quote(sequence)}.NEXTVAL FROM dual";
855856
long result = (long)dbCmd.LongScalar();
856857
LastInsertId = result;
858+
//Set CommandText back
859+
dbCmd.CommandText = lastSql;
857860
return result;
858861
}
859862

0 commit comments

Comments
 (0)