• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Giorgi / DuckDB.NET / 10762260192

08 Sep 2024 06:40PM UTC coverage: 90.033% (-0.2%) from 90.226%
10762260192

push

github

Giorgi
Merge branch 'nightly-varint' into nightly-build

886 of 1013 branches covered (87.46%)

Branch coverage included in aggregate %.

45 of 48 new or added lines in 2 files covered. (93.75%)

32 existing lines in 5 files now uncovered.

1833 of 2007 relevant lines covered (91.33%)

876732.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/DuckDB.NET.Bindings/DuckDBNativeObjects.cs
1
using System;
2
using System.Diagnostics.CodeAnalysis;
3
using System.Numerics;
4
using System.Runtime.InteropServices;
5

6
namespace DuckDB.NET.Native;
7

8
public enum DuckDBState
9
{
10
    Success = 0,
11
    Error = 1
12
}
13

14
public enum DuckDBType
15
{
16
    Invalid = 0,
17
    // bool
18
    Boolean = 1,
19
    // int8_t
20
    TinyInt = 2,
21
    // int16_t
22
    SmallInt = 3,
23
    // int32_t
24
    Integer = 4,
25
    // int64_t
26
    BigInt = 5,
27
    // uint8_t
28
    UnsignedTinyInt = 6,
29
    // uint16_t
30
    UnsignedSmallInt = 7,
31
    // uint32_t
32
    UnsignedInteger = 8,
33
    // uint64_t
34
    UnsignedBigInt = 9,
35
    // float
36
    Float = 10,
37
    // double
38
    Double = 11,
39
    // duckdb_timestamp
40
    Timestamp = 12,
41
    // duckdb_date
42
    Date = 13,
43
    // duckdb_time
44
    Time = 14,
45
    // duckdb_interval
46
    Interval = 15,
47
    // duckdb_hugeint
48
    HugeInt = 16,
49
    // duckdb_uhugeint
50
    UnsignedHugeInt = 32,
51
    // const char*
52
    Varchar = 17,
53
    // duckdb_blob
54
    Blob = 18,
55
    //decimal
56
    Decimal = 19,
57
    // duckdb_timestamp, in seconds
58
    TimestampS = 20,
59
    // duckdb_timestamp, in milliseconds
60
    TimestampMs = 21,
61
    // duckdb_timestamp, in nanoseconds
62
    TimestampNs = 22,
63
    // enum type, only useful as logical type
64
    Enum = 23,
65
    // list type, only useful as logical type
66
    List = 24,
67
    // duckdb_array, only useful as logical type
68
    Array = 33,
69
    // struct type, only useful as logical type
70
    Struct = 25,
71
    // map type, only useful as logical type
72
    Map = 26,
73
    // duckdb_hugeint
74
    Uuid = 27,
75
    // union type, only useful as logical type
76
    Union = 28,
77
    // duckdb_bit
78
    Bit = 29,
79
    // duckdb_time_tz
80
    TimeTz = 30,
81
    // duckdb_timestamp
82
    TimestampTz = 31,
83
    // ANY type
84
    Any = 34,
85
    // duckdb_varint
86
    VarInt = 35,
87
}
88

89
[StructLayout(LayoutKind.Sequential)]
90
public struct DuckDBResult : IDisposable
91
{
92
    [Obsolete]
93
    private long ColumnCount;
94

95
    [Obsolete]
96
    private long RowCount;
97

98
    [Obsolete]
99
    private long RowsChanged;
100

101
    [Obsolete]
102
    private IntPtr columns;
103

104
    [Obsolete]
105
    private IntPtr ErrorMessage;
106

107
    private IntPtr internal_data;
108

109
    public void Dispose()
110
    {
111
        NativeMethods.Query.DuckDBDestroyResult(ref this);
187,113✔
112
    }
187,113✔
113
}
114

115
[StructLayout(LayoutKind.Sequential)]
116
public struct DuckDBDate
117
{
UNCOV
118
    public int Days { get; set; }
×
119
}
120

121
[StructLayout(LayoutKind.Sequential)]
122
public struct DuckDBTime
123
{
124
    public long Micros { get; set; }
60✔
125
}
126

127
[StructLayout(LayoutKind.Sequential)]
128
public struct DuckDBTimeTzStruct
129
{
UNCOV
130
    public ulong Bits { get; set; }
×
131
}
132

133
[StructLayout(LayoutKind.Sequential)]
134
public struct DuckDBTimeTz
135
{
136
    public DuckDBTimeOnly Time { get; set; }
102✔
137
    public int Offset { get; set; }
102✔
138
}
139

140
[StructLayout(LayoutKind.Sequential)]
141
public struct DuckDBTimestampStruct
142
{
143
    public long Micros { get; set; }
46,770✔
144

145
    public readonly DateTime ToDateTime()
146
    {
147
        var ticks = Micros * 10 + Utils.UnixEpochTicks;
15,438✔
148
        return new DateTime(ticks);
15,438✔
149
    }
150
}
151

152
[StructLayout(LayoutKind.Sequential)]
153
public readonly struct DuckDBBlob : IDisposable
154
{
155
    public IntPtr Data { get; }
×
156

UNCOV
157
    public long Size { get; }
×
158

159
    public void Dispose()
160
    {
UNCOV
161
        NativeMethods.Helpers.DuckDBFree(Data);
×
UNCOV
162
    }
×
163
}
164

165
[StructLayout(LayoutKind.Sequential)]
166
public struct DuckDBListEntry(ulong offset, ulong length)
167
{
168
    public ulong Offset { get; private set; } = offset;
1,785,941✔
169
    public ulong Length { get; private set; } = length;
1,785,974✔
170
}
171

172
public struct DuckDBString
173
{
174
    public _value_e__Union value;
175

176
    private const int InlineStringMaxLength = 12;
177

178
    public readonly int Length => (int)value.inlined.length;
2,944,337✔
179

180
    public readonly unsafe sbyte* Data
181
    {
182
        get
183
        {
184
            if (Length <= InlineStringMaxLength)
1,129,246✔
185
            {
368,534✔
186
                fixed (sbyte* pointerToFirst = value.inlined.inlined)
368,534✔
187
                {
188
                    return pointerToFirst;
368,534✔
189
                }
190
            }
191
            else
192
            {
193
                return value.pointer.ptr;
760,712✔
194
            }
195
        }
196
    }
197

198
    [StructLayout(LayoutKind.Explicit)]
199
    public partial struct _value_e__Union
200
    {
201
        [FieldOffset(0)]
202
        public DuckDBStringPointer pointer;
203

204
        [FieldOffset(0)]
205
        public DuckDBStringInlined inlined;
206

207
        public unsafe partial struct DuckDBStringPointer
208
        {
209
            public uint length;
210

211
            public fixed sbyte prefix[4];
212

213
            public sbyte* ptr;
214
        }
215

216
        public unsafe partial struct DuckDBStringInlined
217
        {
218
            public uint length;
219

220
            public fixed sbyte inlined[12];
221
        }
222
    }
223
}
224

225
public enum DuckDBStatementType
226
{
227
    Invalid = 0,
228
    Select,
229
    Insert,
230
    Update,
231
    Explain,
232
    Delete,
233
    Prepare,
234
    Create,
235
    Execute,
236
    Alter,
237
    Transaction,
238
    Copy,
239
    Analyze,
240
    VariableSet,
241
    CreateFunc,
242
    Drop,
243
    Export,
244
    Pragma,
245
    Show,
246
    Vacuum,
247
    Call,
248
    Set,
249
    Load,
250
    Relation,
251
    Extension,
252
    LogicalPlan,
253
    Attach,
254
    Detach,
255
    Multi,
256
}
257

258
public enum DuckDBResultType
259
{
260
    Invalid = 0,
261
    ChangedRows,
262
    Nothing,
263
    QueryResult,
264
}
265

266
public enum DuckDBErrorType
267
{
268
    Invalid = 0,
269
    OutOfRange = 1,
270
    Conversion = 2,
271
    UnknownType = 3,
272
    Decimal = 4,
273
    MismatchType = 5,
274
    DivideByZero = 6,
275
    ObjectSize = 7,
276
    InvalidType = 8,
277
    Serialization = 9,
278
    Transaction = 10,
279
    NotImplemented = 11,
280
    Expression = 12,
281
    Catalog = 13,
282
    Parser = 14,
283
    Planner = 15,
284
    Scheduler = 16,
285
    Executor = 17,
286
    Constraint = 18,
287
    Index = 19,
288
    Stat = 20,
289
    Connection = 21,
290
    Syntax = 22,
291
    Settings = 23,
292
    Binder = 24,
293
    Network = 25,
294
    Optimizer = 26,
295
    NullPointer = 27,
296
    Io = 28,
297
    Interrupt = 29,
298
    Fatal = 30,
299
    Internal = 31,
300
    InvalidInput = 32,
301
    OutOfMemory = 33,
302
    Permission = 34,
303
    ParameterNotResolved = 35,
304
    ParameterNotAllowed = 36,
305
    Dependency = 37,
306
    Http = 38,
307
    MissingExtension = 39,
308
    Autoload = 40,
309
    Sequence = 41
310
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc