Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion DuckDB.NET.Data/DuckDBCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class DuckDBCommand : DbCommand
public new virtual DuckDBParameterCollection Parameters => parameters;

public override int CommandTimeout { get; set; }
public override CommandType CommandType { get; set; }
public override CommandType CommandType { get; set; } = CommandType.Text;
public override bool DesignTimeVisible { get; set; }
public override UpdateRowSource UpdatedRowSource { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion DuckDB.NET.Data/DuckDBParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public override object? Value
}
}

public override ParameterDirection Direction { get; set; }
public override ParameterDirection Direction { get; set; } = ParameterDirection.Input;
public override bool IsNullable { get; set; }

[AllowNull]
Expand Down
9 changes: 8 additions & 1 deletion DuckDB.NET.Test/DuckDBCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@ public void SetCommandTextAndConnection()
cmd.CommandText.Should().Be("Select 1");
cmd.Connection.Should().Be(Connection);
}
}

// https://learn.microsoft.com/dotnet/api/system.data.idbcommand.commandtype: "The default is Text."
[Fact]
public void CommandTypeDefaultsToText()
{
new DuckDBCommand().CommandType.Should().Be(CommandType.Text);
}
}
9 changes: 9 additions & 0 deletions DuckDB.NET.Test/Parameters/ParameterCollectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ namespace DuckDB.NET.Test.Parameters;

public class ParameterCollectionTests(DuckDBDatabaseFixture db) : DuckDBTestBase(db)
{
// https://learn.microsoft.com/dotnet/api/system.data.common.dbparameter.direction: "The default is Input."
[Fact]
public void ParameterDirectionDefaultsToInput()
{
new DuckDBParameter().Direction.Should().Be(ParameterDirection.Input);
new DuckDBParameter("name", 42).Direction.Should().Be(ParameterDirection.Input);
Command.CreateParameter().Direction.Should().Be(ParameterDirection.Input);
}

[Theory]
[InlineData("SELECT ?1::INT;")]
[InlineData("SELECT ?::INT;")]
Expand Down
Loading