3
3
export const sizeof_bool : number ;
4
4
5
5
export enum PendingState {
6
- RESULT_READY = 0 ,
7
- RESULT_NOT_READY = 1 ,
8
- ERROR = 2 ,
9
- NO_TASKS_AVAILABLE = 3 ,
6
+ RESULT_READY = 0 ,
7
+ RESULT_NOT_READY = 1 ,
8
+ ERROR = 2 ,
9
+ NO_TASKS_AVAILABLE = 3 ,
10
10
}
11
11
12
12
export enum ResultType {
13
13
INVALID = 0 ,
14
- CHANGED_ROWS = 1 ,
15
- NOTHING = 2 ,
16
- QUERY_RESULT = 3 ,
14
+ CHANGED_ROWS = 1 ,
15
+ NOTHING = 2 ,
16
+ QUERY_RESULT = 3 ,
17
17
}
18
18
19
19
export enum StatementType {
20
20
INVALID = 0 ,
21
- SELECT = 1 ,
22
- INSERT = 2 ,
23
- UPDATE = 3 ,
24
- EXPLAIN = 4 ,
25
- DELETE = 5 ,
26
- PREPARE = 6 ,
27
- CREATE = 7 ,
28
- EXECUTE = 8 ,
29
- ALTER = 9 ,
30
- TRANSACTION = 10 ,
31
- COPY = 11 ,
32
- ANALYZE = 12 ,
33
- VARIABLE_SET = 13 ,
34
- CREATE_FUNC = 14 ,
35
- DROP = 15 ,
36
- EXPORT = 16 ,
37
- PRAGMA = 17 ,
38
- VACUUM = 18 ,
39
- CALL = 19 ,
40
- SET = 20 ,
41
- LOAD = 21 ,
42
- RELATION = 22 ,
43
- EXTENSION = 23 ,
44
- LOGICAL_PLAN = 24 ,
45
- ATTACH = 25 ,
46
- DETACH = 26 ,
47
- MULTI = 27 ,
21
+ SELECT = 1 ,
22
+ INSERT = 2 ,
23
+ UPDATE = 3 ,
24
+ EXPLAIN = 4 ,
25
+ DELETE = 5 ,
26
+ PREPARE = 6 ,
27
+ CREATE = 7 ,
28
+ EXECUTE = 8 ,
29
+ ALTER = 9 ,
30
+ TRANSACTION = 10 ,
31
+ COPY = 11 ,
32
+ ANALYZE = 12 ,
33
+ VARIABLE_SET = 13 ,
34
+ CREATE_FUNC = 14 ,
35
+ DROP = 15 ,
36
+ EXPORT = 16 ,
37
+ PRAGMA = 17 ,
38
+ VACUUM = 18 ,
39
+ CALL = 19 ,
40
+ SET = 20 ,
41
+ LOAD = 21 ,
42
+ RELATION = 22 ,
43
+ EXTENSION = 23 ,
44
+ LOGICAL_PLAN = 24 ,
45
+ ATTACH = 25 ,
46
+ DETACH = 26 ,
47
+ MULTI = 27 ,
48
48
}
49
49
50
50
export enum Type {
51
51
INVALID = 0 ,
52
- BOOLEAN = 1 ,
53
- TINYINT = 2 ,
54
- SMALLINT = 3 ,
55
- INTEGER = 4 ,
56
- BIGINT = 5 ,
57
- UTINYINT = 6 ,
58
- USMALLINT = 7 ,
59
- UINTEGER = 8 ,
60
- UBIGINT = 9 ,
61
- FLOAT = 10 ,
62
- DOUBLE = 11 ,
63
- TIMESTAMP = 12 ,
64
- DATE = 13 ,
65
- TIME = 14 ,
66
- INTERVAL = 15 ,
67
- HUGEINT = 16 ,
68
- UHUGEINT = 32 ,
69
- VARCHAR = 17 ,
70
- BLOB = 18 ,
71
- DECIMAL = 19 ,
72
- TIMESTAMP_S = 20 ,
73
- TIMESTAMP_MS = 21 ,
74
- TIMESTAMP_NS = 22 ,
75
- ENUM = 23 ,
76
- LIST = 24 ,
77
- STRUCT = 25 ,
78
- MAP = 26 ,
79
- ARRAY = 33 ,
80
- UUID = 27 ,
81
- UNION = 28 ,
82
- BIT = 29 ,
83
- TIME_TZ = 30 ,
84
- TIMESTAMP_TZ = 31 ,
52
+ BOOLEAN = 1 ,
53
+ TINYINT = 2 ,
54
+ SMALLINT = 3 ,
55
+ INTEGER = 4 ,
56
+ BIGINT = 5 ,
57
+ UTINYINT = 6 ,
58
+ USMALLINT = 7 ,
59
+ UINTEGER = 8 ,
60
+ UBIGINT = 9 ,
61
+ FLOAT = 10 ,
62
+ DOUBLE = 11 ,
63
+ TIMESTAMP = 12 ,
64
+ DATE = 13 ,
65
+ TIME = 14 ,
66
+ INTERVAL = 15 ,
67
+ HUGEINT = 16 ,
68
+ UHUGEINT = 32 ,
69
+ VARCHAR = 17 ,
70
+ BLOB = 18 ,
71
+ DECIMAL = 19 ,
72
+ TIMESTAMP_S = 20 ,
73
+ TIMESTAMP_MS = 21 ,
74
+ TIMESTAMP_NS = 22 ,
75
+ ENUM = 23 ,
76
+ LIST = 24 ,
77
+ STRUCT = 25 ,
78
+ MAP = 26 ,
79
+ ARRAY = 33 ,
80
+ UUID = 27 ,
81
+ UNION = 28 ,
82
+ BIT = 29 ,
83
+ TIME_TZ = 30 ,
84
+ TIMESTAMP_TZ = 31 ,
85
85
}
86
86
87
87
@@ -98,21 +98,21 @@ export interface DateParts {
98
98
}
99
99
100
100
export interface Decimal {
101
- width : number ;
102
- scale : number ;
103
- value : bigint ;
101
+ width : number ;
102
+ scale : number ;
103
+ value : bigint ;
104
104
}
105
105
106
106
export interface Interval {
107
- months : number ;
108
- days : number ;
109
- micros : bigint ;
107
+ months : number ;
108
+ days : number ;
109
+ micros : bigint ;
110
110
}
111
111
112
112
export interface QueryProgress {
113
113
percentage : number ;
114
- rows_processed : number ;
115
- total_rows_to_process : number ;
114
+ rows_processed : bigint ;
115
+ total_rows_to_process : bigint ;
116
116
}
117
117
118
118
export interface Time {
@@ -127,71 +127,82 @@ export interface TimeParts {
127
127
}
128
128
129
129
export interface TimeTZ {
130
- /** 40 bits for micros, 24 bits for offset */
131
- bits : number ; // or bigint, or buffer?
130
+ /**
131
+ * 40 bits for micros, then 24 bits for encoded offset in seconds.
132
+ *
133
+ * Max absolute unencoded offset = 15:59:59 = 60 * (60 * 15 + 59) + 59 = 57599.
134
+ *
135
+ * Encoded offset is unencoded offset inverted then shifted (by +57599) to unsigned.
136
+ *
137
+ * Max unencoded offset = 57599 -> -57599 -> 0 encoded.
138
+ *
139
+ * Min unencoded offset = -57599 -> 57599 -> 115198 encoded.
140
+ */
141
+ bits : bigint ;
132
142
}
133
143
export interface TimeTZParts {
134
144
time : TimeParts ;
145
+ /** Offset in seconds, from -15:59:59 = -57599 to 15:59:59 = 57599 */
135
146
offset : number ;
136
147
}
137
148
138
149
export interface Timestamp {
139
- /** Microseconds since 1970-01-01 */
140
- micros : bigint ;
150
+ /** Microseconds since 1970-01-01 */
151
+ micros : bigint ;
141
152
}
142
153
export interface TimestampParts {
143
- date : DateParts ;
144
- time : TimeParts ;
154
+ date : DateParts ;
155
+ time : TimeParts ;
145
156
}
146
157
147
158
export interface Vector {
148
- __duckdb_type : 'duckdb_vector' ;
159
+ __duckdb_type : 'duckdb_vector' ;
149
160
}
150
161
151
162
// Types (explicit destroy)
152
163
153
164
export interface Appender {
154
- __duckdb_type : 'duckdb_appender' ;
165
+ __duckdb_type : 'duckdb_appender' ;
155
166
}
156
167
157
168
export interface Config {
158
- __duckdb_type : 'duckdb_config' ;
169
+ __duckdb_type : 'duckdb_config' ;
159
170
}
160
171
161
172
export interface Connection {
162
- __duckdb_type : 'duckdb_connection' ;
173
+ __duckdb_type : 'duckdb_connection' ;
163
174
}
164
175
165
176
export interface Database {
166
- __duckdb_type : 'duckdb_database' ;
177
+ __duckdb_type : 'duckdb_database' ;
167
178
}
168
179
169
180
export interface DataChunk {
170
- __duckdb_type : 'duckdb_data_chunk' ;
181
+ __duckdb_type : 'duckdb_data_chunk' ;
171
182
}
172
183
173
184
export interface ExtractedStatements {
174
- __duckdb_type : 'duckdb_extracted_statements' ;
185
+ __duckdb_type : 'duckdb_extracted_statements' ;
175
186
}
176
187
177
188
export interface LogicalType {
178
- __duckdb_type : 'duckdb_logical_type' ;
189
+ __duckdb_type : 'duckdb_logical_type' ;
179
190
}
180
191
181
192
export interface PendingResult {
182
- __duckdb_type : 'duckdb_pending_result' ;
193
+ __duckdb_type : 'duckdb_pending_result' ;
183
194
}
184
195
185
196
export interface PreparedStatement {
186
- __duckdb_type : 'duckdb_config ' ;
197
+ __duckdb_type : 'duckdb_prepared_statement ' ;
187
198
}
188
199
189
200
export interface Result {
190
- __duckdb_type : 'duckdb_result' ;
201
+ __duckdb_type : 'duckdb_result' ;
191
202
}
192
203
193
204
export interface Value {
194
- __duckdb_type : 'duckdb_value' ;
205
+ __duckdb_type : 'duckdb_value' ;
195
206
}
196
207
197
208
// Types (TypeScript only)
@@ -202,8 +213,8 @@ export interface ConfigFlag {
202
213
}
203
214
204
215
export interface ExtractedStatementsAndCount {
205
- extracted_statements : ExtractedStatements ;
206
- statement_count : number ;
216
+ extracted_statements : ExtractedStatements ;
217
+ statement_count : number ;
207
218
}
208
219
209
220
@@ -659,7 +670,7 @@ export function vector_get_column_type(vector: Vector): LogicalType;
659
670
export function vector_get_data ( vector : Vector , byte_count : number ) : Uint8Array ;
660
671
661
672
// DUCKDB_API uint64_t *duckdb_vector_get_validity(duckdb_vector vector);
662
- export function vector_get_validity ( vector : Vector , byte_cunt : number ) : Uint8Array ;
673
+ export function vector_get_validity ( vector : Vector , byte_count : number ) : Uint8Array ;
663
674
664
675
// DUCKDB_API void duckdb_vector_ensure_validity_writable(duckdb_vector vector);
665
676
export function vector_ensure_validity_writable ( vector : Vector ) : void ;
0 commit comments