Skip to content

Commit

Permalink
now converts biginteger to byte[] on sql function calls (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
runeanielsen authored Jan 12, 2022
1 parent 9889cb4 commit 1fc381c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/MsSqlCdc/CdcDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal static class CdcDatabase
var sql = "SELECT sys.fn_cdc_map_lsn_to_time(@lsn)";

using var command = new SqlCommand(sql, connection);
command.Parameters.AddWithValue("@lsn", lsn);
command.Parameters.AddWithValue("@lsn", lsn.ToByteArray());

return (DateTime?)(await command.ExecuteScalarAsync());
}
Expand Down Expand Up @@ -91,7 +91,7 @@ internal static class CdcDatabase
{
var sql = "SELECT sys.fn_cdc_decrement_lsn(@lsn)";
using var command = new SqlCommand(sql, connection);
command.Parameters.AddWithValue("@lsn", lsn);
command.Parameters.AddWithValue("@lsn", lsn.ToByteArray());

return (byte[]?)(await command.ExecuteScalarAsync());
}
Expand All @@ -100,7 +100,7 @@ internal static class CdcDatabase
{
var sql = "SELECT sys.fn_cdc_increment_lsn(@lsn)";
using var command = new SqlCommand(sql, connection);
command.Parameters.AddWithValue("@lsn", lsn);
command.Parameters.AddWithValue("@lsn", lsn.ToByteArray());

return (byte[]?)(await command.ExecuteScalarAsync());
}
Expand Down Expand Up @@ -148,8 +148,8 @@ internal static class CdcDatabase
var sql = $"SELECT * FROM {cdcFunction}_{captureInstance}(@begin_lsn, @end_lsn, @filter_option)";

using var command = new SqlCommand(sql, connection);
command.Parameters.AddWithValue("@begin_lsn", beginLsn);
command.Parameters.AddWithValue("@end_lsn", endLsn);
command.Parameters.AddWithValue("@begin_lsn", beginLsn.ToByteArray());
command.Parameters.AddWithValue("@end_lsn", endLsn.ToByteArray());
command.Parameters.AddWithValue("@filter_option", filterOption);

var changes = new List<List<(string name, object value)>>();
Expand Down

0 comments on commit 1fc381c

Please sign in to comment.