Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6505fd5
Add support for BigInteger, Int128, and UInt128 in SqliteValueBinder
MaikyOzr Jan 11, 2026
468c26b
Merge pull request #1 from MaikyOzr/Support-BigInteger-MaikyOzr
MaikyOzr Jan 12, 2026
5695bf6
Merge branch 'dotnet:main' into main
MaikyOzr Jan 12, 2026
cf207a6
Merge branch 'dotnet:main' into main
MaikyOzr Jan 13, 2026
ddba8c6
Merge branch 'dotnet:main' into main
MaikyOzr Jan 14, 2026
a513fbe
Merge branch 'dotnet:main' into main
MaikyOzr Jan 29, 2026
17b9daf
Update src/Microsoft.Data.Sqlite.Core/SqliteValueBinder.cs
MaikyOzr Feb 5, 2026
6f989c7
Merge branch 'dotnet:main' into main
MaikyOzr Feb 5, 2026
1c60251
Merge branch 'dotnet:main' into main
MaikyOzr Feb 6, 2026
d88ec3d
Merge branch 'dotnet:main' into main
MaikyOzr Feb 8, 2026
11ca44c
Merge branch 'dotnet:main' into main
MaikyOzr Feb 16, 2026
5af521c
Merge branch 'dotnet:main' into main
MaikyOzr Feb 18, 2026
27f93d0
Merge branch 'dotnet:main' into main
MaikyOzr Feb 20, 2026
e978f43
Merge branch 'dotnet:main' into main
MaikyOzr Feb 21, 2026
a439291
Merge branch 'dotnet:main' into main
MaikyOzr Feb 22, 2026
309cb03
Merge branch 'dotnet:main' into main
MaikyOzr Feb 27, 2026
2902ea2
Merge branch 'dotnet:main' into main
MaikyOzr Feb 28, 2026
0b2c794
Merge branch 'dotnet:main' into main
MaikyOzr Mar 1, 2026
4ad4fb1
Create sync.yml
MaikyOzr Mar 1, 2026
3fab19a
Update sync.yml
MaikyOzr Mar 1, 2026
3e2f0e0
Update TestCosmos.yaml
MaikyOzr Mar 1, 2026
d388163
Update TestCosmos.yaml
MaikyOzr Mar 1, 2026
ae8b251
Update sync.yml
MaikyOzr Mar 1, 2026
48138a4
Delete .github/workflows/sync.yml
MaikyOzr Mar 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/Microsoft.Data.Sqlite.Core/SqliteValueBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Numerics;
using Microsoft.Data.Sqlite.Properties;

namespace Microsoft.Data.Sqlite;
Expand Down Expand Up @@ -238,6 +239,20 @@ public virtual void Bind()
var value1 = (long)(ushort)value;
BindInt64(value1);
}
else if (type == typeof(BigInteger))
{
BindText(((BigInteger)value).ToString(CultureInfo.InvariantCulture));
}
#if NET7_0_OR_GREATER
else if (type == typeof(Int128))
{
BindText(((Int128)value).ToString(CultureInfo.InvariantCulture));
}
else if (type == typeof(UInt128))
{
BindText(((UInt128)value).ToString(CultureInfo.InvariantCulture));
}
#endif
else
{
throw new InvalidOperationException(Resources.UnknownDataType(type));
Expand All @@ -259,7 +274,13 @@ public virtual void Bind()
{ typeof(DateOnly), SqliteType.Text },
{ typeof(TimeOnly), SqliteType.Text },
#endif

{ typeof(DBNull), SqliteType.Text },
{ typeof(BigInteger), SqliteType.Text },
#if NET7_0_OR_GREATER
{ typeof(Int128), SqliteType.Text },
{ typeof(UInt128), SqliteType.Text },
#endif
{ typeof(decimal), SqliteType.Text },
{ typeof(double), SqliteType.Real },
{ typeof(float), SqliteType.Real },
Expand Down
49 changes: 49 additions & 0 deletions test/Microsoft.Data.Sqlite.Tests/SqliteParameterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Numerics;
using Microsoft.Data.Sqlite.Properties;
using Microsoft.Data.Sqlite.TestUtilities;
using Xunit;
Expand Down Expand Up @@ -588,6 +589,54 @@ public void Add_range_of_parameters_using_DbCommand_base_class()
}
}

[Fact]
public void Bind_BigInteger_parameter_as_text()
{
using (var connection = new SqliteConnection("Data Source=:memory:"))
{
var command = connection.CreateCommand();
command.CommandText = "SELECT @Parameter;";
var value = BigInteger.Parse("1234567890123456789012345678901234567890");
command.Parameters.AddWithValue("@Parameter", value);
connection.Open();
var result = (string)command.ExecuteScalar()!;
Assert.Equal("1234567890123456789012345678901234567890", result);
}
}


#if NET7_0_OR_GREATER
[Fact]
public void Bind_Int128_parameter_as_text()
{
using (var connection = new SqliteConnection("Data Source=:memory:"))
{
var command = connection.CreateCommand();
command.CommandText = "SELECT @Parameter;";
var value = Int128.Parse("170141183460469231731687303715884105727");
command.Parameters.AddWithValue("@Parameter", value);
connection.Open();
var result = (string)command.ExecuteScalar()!;
Assert.Equal("170141183460469231731687303715884105727", result);
}
}

[Fact]
public void Bind_UInt128_parameter_as_text()
{
using (var connection = new SqliteConnection("Data Source=:memory:"))
{
var command = connection.CreateCommand();
command.CommandText = "SELECT @Parameter;";
var value = UInt128.Parse("340282366920938463463374607431768211455");
command.Parameters.AddWithValue("@Parameter", value);
connection.Open();
var result = (string)command.ExecuteScalar()!;
Assert.Equal("340282366920938463463374607431768211455", result);
}
}
#endif

public static IEnumerable<object[]> TypesData
=> new List<object[]>
{
Expand Down