mirror of
https://github.com/allankoechke/turso.git
synced 2026-11-30 11:12:58 +00:00
bindings/dotnet: test columns without a declared type
Cover expressions and a column declared without a type, where turso_statement_column_decltype returns nothing: values come back as stored and are not converted to Guid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1092,6 +1092,31 @@ public class SqliteFacadeTests
|
||||
reader.Invoking(r => r.GetDataTypeName(2)).Should().Throw<ArgumentOutOfRangeException>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetValueUsesStorageTypeWhenNoDeclaredTypeIsAvailable()
|
||||
{
|
||||
using var connection = new SqliteConnection("Data Source=:memory:");
|
||||
connection.Open();
|
||||
connection.ExecuteNonQuery(
|
||||
"""
|
||||
CREATE TABLE Items (Id GUID, Untyped);
|
||||
INSERT INTO Items VALUES ('dc0d7e0e-365d-4948-ab9b-8ca8056bf93a', 'dc0d7e0e-365d-4948-ab9b-8ca8056bf93a');
|
||||
""");
|
||||
|
||||
// An expression over a GUID column and a column declared without a type have no declared type,
|
||||
// so values are returned as stored instead of being converted to Guid.
|
||||
using var reader = connection.ExecuteReader("SELECT lower(Id), Untyped, Id || '', 1 + 1 FROM Items");
|
||||
reader.Read().Should().BeTrue();
|
||||
reader.GetDataTypeName(0).Should().Be("TEXT");
|
||||
reader.GetValue(0).Should().Be("dc0d7e0e-365d-4948-ab9b-8ca8056bf93a");
|
||||
reader.GetDataTypeName(1).Should().Be("TEXT");
|
||||
reader.GetValue(1).Should().Be("dc0d7e0e-365d-4948-ab9b-8ca8056bf93a");
|
||||
reader.GetDataTypeName(2).Should().Be("TEXT");
|
||||
reader.GetValue(2).Should().Be("dc0d7e0e-365d-4948-ab9b-8ca8056bf93a");
|
||||
reader.GetDataTypeName(3).Should().Be("INTEGER");
|
||||
reader.GetValue(3).Should().Be(2L);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetFieldValueThrowsForNullTypedValues()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user