Repository navigation
Expand file tree
/
Copy pathDuckDBParameter.cs
More file actions
69 lines (55 loc) · 1.69 KB
/
Copy pathDuckDBParameter.cs
File metadata and controls
69 lines (55 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using DuckDB.NET.Data.PreparedStatement;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
namespace DuckDB.NET.Data;
public class DuckDBParameter : DbParameter
{
private const DbType DefaultDbType = DbType.String;
private object? value;
public override DbType DbType { get; set; }
[AllowNull]
[DefaultValue("")]
public override string ParameterName { get; set; }
public override object? Value
{
get => value;
set
{
if (this.value != value)
{
this.value = value;
DbType = DuckDBTypeMap.GetDbTypeForValue(value);
}
}
}
public override ParameterDirection Direction { get; set; }
public override bool IsNullable { get; set; }
[AllowNull]
[DefaultValue("")]
public override string SourceColumn { get; set; }
public override bool SourceColumnNullMapping { get; set; }
public override int Size { get; set; }
public DuckDBParameter()
: this (string.Empty, DefaultDbType, null)
{ }
public DuckDBParameter(object value)
: this(string.Empty, DuckDBTypeMap.GetDbTypeForValue(value), value)
{
}
public DuckDBParameter(DbType type, object? value)
: this(string.Empty, type, value)
{
}
public DuckDBParameter(string name, object? value)
: this(name, DuckDBTypeMap.GetDbTypeForValue(value), value)
{
}
public DuckDBParameter(string name, DbType type, object? value)
{
DbType = type;
ParameterName = name;
this.value = value;
SourceColumn = string.Empty;
}
public override void ResetDbType() => DbType = DefaultDbType;
}