@qualithm/arrow-flight-sql-js 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +194 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +310 -1
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -28,6 +28,66 @@ export type UpdateResult = {
|
|
|
28
28
|
*/
|
|
29
29
|
recordCount: number;
|
|
30
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Options for creating a prepared statement.
|
|
33
|
+
*/
|
|
34
|
+
export type PreparedStatementOptions = CallOptions & {
|
|
35
|
+
/**
|
|
36
|
+
* Transaction ID for creating the prepared statement as part of a transaction.
|
|
37
|
+
* If not provided, executions of the prepared statement will be auto-committed.
|
|
38
|
+
*/
|
|
39
|
+
transactionId?: Buffer;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Result of creating a prepared statement.
|
|
43
|
+
*/
|
|
44
|
+
export type PreparedStatementResult = {
|
|
45
|
+
/**
|
|
46
|
+
* Opaque handle for the prepared statement on the server.
|
|
47
|
+
* Use this handle with executePreparedQuery or executePreparedUpdate.
|
|
48
|
+
*/
|
|
49
|
+
handle: Buffer;
|
|
50
|
+
/**
|
|
51
|
+
* The schema of the result set, if the query returns results.
|
|
52
|
+
* This is an IPC-encapsulated Schema as described in Schema.fbs.
|
|
53
|
+
* May be empty if the query does not return results.
|
|
54
|
+
*/
|
|
55
|
+
datasetSchema: Buffer;
|
|
56
|
+
/**
|
|
57
|
+
* The schema of the expected parameters, if the query has parameters.
|
|
58
|
+
* This is an IPC-encapsulated Schema as described in Schema.fbs.
|
|
59
|
+
* May be empty if the query has no parameters.
|
|
60
|
+
*/
|
|
61
|
+
parameterSchema: Buffer;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Result of binding parameters to a prepared statement.
|
|
65
|
+
*/
|
|
66
|
+
export type BindParametersResult = {
|
|
67
|
+
/**
|
|
68
|
+
* Updated handle for the prepared statement.
|
|
69
|
+
* If provided, this handle should be used for subsequent operations
|
|
70
|
+
* instead of the original handle. If undefined, continue using the
|
|
71
|
+
* original handle.
|
|
72
|
+
*/
|
|
73
|
+
handle?: Buffer;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Parameter data for binding to a prepared statement.
|
|
77
|
+
* Can be provided as raw Arrow IPC bytes or as separate schema/data components.
|
|
78
|
+
*/
|
|
79
|
+
export type ParameterData = {
|
|
80
|
+
/**
|
|
81
|
+
* Arrow IPC schema message bytes.
|
|
82
|
+
* Required when sending parameters.
|
|
83
|
+
*/
|
|
84
|
+
schema: Uint8Array;
|
|
85
|
+
/**
|
|
86
|
+
* Arrow IPC record batch data bytes.
|
|
87
|
+
* Contains the actual parameter values.
|
|
88
|
+
*/
|
|
89
|
+
data: Uint8Array;
|
|
90
|
+
};
|
|
31
91
|
/**
|
|
32
92
|
* Arrow Flight SQL client for executing SQL queries and commands.
|
|
33
93
|
*
|
|
@@ -80,6 +140,60 @@ export declare class FlightSqlClient extends FlightClient {
|
|
|
80
140
|
* ```
|
|
81
141
|
*/
|
|
82
142
|
query(query: string, options?: QueryOptions): Promise<FlightInfo>;
|
|
143
|
+
/**
|
|
144
|
+
* Executes a prepared statement query and returns flight information for retrieving results.
|
|
145
|
+
*
|
|
146
|
+
* This method sends a CommandPreparedStatementQuery to the server and returns
|
|
147
|
+
* FlightInfo containing endpoints for data retrieval. Use the returned
|
|
148
|
+
* FlightInfo with `doGet()` to retrieve the actual data.
|
|
149
|
+
*
|
|
150
|
+
* @param handle - The prepared statement handle from createPreparedStatement
|
|
151
|
+
* @param options - Optional call options
|
|
152
|
+
* @returns Flight information for retrieving query results
|
|
153
|
+
* @throws {FlightError} If the query fails
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* const prepared = await client.createPreparedStatement("SELECT * FROM users WHERE id = ?")
|
|
158
|
+
*
|
|
159
|
+
* // Execute the prepared statement
|
|
160
|
+
* const info = await client.executePreparedQuery(prepared.handle)
|
|
161
|
+
*
|
|
162
|
+
* // Retrieve data from each endpoint
|
|
163
|
+
* for (const endpoint of info.endpoint) {
|
|
164
|
+
* for await (const data of client.doGet(endpoint.ticket!)) {
|
|
165
|
+
* // Process data
|
|
166
|
+
* }
|
|
167
|
+
* }
|
|
168
|
+
*
|
|
169
|
+
* // Clean up
|
|
170
|
+
* await client.closePreparedStatement(prepared.handle)
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
executePreparedQuery(handle: Buffer, options?: CallOptions): Promise<FlightInfo>;
|
|
174
|
+
/**
|
|
175
|
+
* Executes a prepared statement update (INSERT, UPDATE, DELETE).
|
|
176
|
+
*
|
|
177
|
+
* @param handle - The prepared statement handle from createPreparedStatement
|
|
178
|
+
* @param options - Optional call options
|
|
179
|
+
* @returns The update result containing the number of affected records
|
|
180
|
+
* @throws {FlightError} If the update fails
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```ts
|
|
184
|
+
* const prepared = await client.createPreparedStatement(
|
|
185
|
+
* "UPDATE users SET active = false WHERE id = ?"
|
|
186
|
+
* )
|
|
187
|
+
*
|
|
188
|
+
* // Execute the prepared statement
|
|
189
|
+
* const result = await client.executePreparedUpdate(prepared.handle)
|
|
190
|
+
* console.log("Rows updated:", result.recordCount)
|
|
191
|
+
*
|
|
192
|
+
* // Clean up
|
|
193
|
+
* await client.closePreparedStatement(prepared.handle)
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
executePreparedUpdate(handle: Buffer, options?: CallOptions): Promise<UpdateResult>;
|
|
83
197
|
/**
|
|
84
198
|
* Executes a SQL update statement (INSERT, UPDATE, DELETE).
|
|
85
199
|
*
|
|
@@ -97,6 +211,86 @@ export declare class FlightSqlClient extends FlightClient {
|
|
|
97
211
|
* ```
|
|
98
212
|
*/
|
|
99
213
|
executeUpdate(query: string, options?: QueryOptions): Promise<UpdateResult>;
|
|
214
|
+
/**
|
|
215
|
+
* Creates a prepared statement for the given SQL query.
|
|
216
|
+
*
|
|
217
|
+
* The returned handle can be used to execute the query multiple times
|
|
218
|
+
* with different parameters. The prepared statement should be closed
|
|
219
|
+
* when no longer needed using `closePreparedStatement()`.
|
|
220
|
+
*
|
|
221
|
+
* @param query - The SQL query to prepare
|
|
222
|
+
* @param options - Optional options including transaction ID
|
|
223
|
+
* @returns The prepared statement result containing the handle and schemas
|
|
224
|
+
* @throws {FlightError} If the preparation fails
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* const prepared = await client.createPreparedStatement(
|
|
229
|
+
* "SELECT * FROM users WHERE id = ?"
|
|
230
|
+
* )
|
|
231
|
+
*
|
|
232
|
+
* // Use prepared.handle with executePreparedQuery
|
|
233
|
+
* // ...
|
|
234
|
+
*
|
|
235
|
+
* // Clean up when done
|
|
236
|
+
* await client.closePreparedStatement(prepared.handle)
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
createPreparedStatement(query: string, options?: PreparedStatementOptions): Promise<PreparedStatementResult>;
|
|
240
|
+
/**
|
|
241
|
+
* Closes a prepared statement and releases server resources.
|
|
242
|
+
*
|
|
243
|
+
* @param handle - The prepared statement handle to close
|
|
244
|
+
* @param options - Optional call options
|
|
245
|
+
* @throws {FlightError} If closing fails
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```ts
|
|
249
|
+
* const prepared = await client.createPreparedStatement("SELECT * FROM users")
|
|
250
|
+
* // ... use the prepared statement ...
|
|
251
|
+
* await client.closePreparedStatement(prepared.handle)
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
closePreparedStatement(handle: Buffer, options?: CallOptions): Promise<void>;
|
|
255
|
+
/**
|
|
256
|
+
* Binds parameter values to a prepared statement.
|
|
257
|
+
*
|
|
258
|
+
* Parameter values are sent as Arrow IPC data matching the parameter schema
|
|
259
|
+
* from the prepared statement. After binding, call `executePreparedQuery()`
|
|
260
|
+
* or `executePreparedUpdate()` to execute with the bound parameters.
|
|
261
|
+
*
|
|
262
|
+
* @param handle - The prepared statement handle
|
|
263
|
+
* @param parameters - The parameter data as Arrow IPC bytes
|
|
264
|
+
* @param options - Optional call options
|
|
265
|
+
* @returns Result containing an optional updated handle
|
|
266
|
+
* @throws {FlightError} If binding fails
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```ts
|
|
270
|
+
* import { tableToIPC, tableFromArrays } from "apache-arrow"
|
|
271
|
+
*
|
|
272
|
+
* const prepared = await client.createPreparedStatement(
|
|
273
|
+
* "SELECT * FROM users WHERE id = ?"
|
|
274
|
+
* )
|
|
275
|
+
*
|
|
276
|
+
* // Create parameter data as Arrow IPC
|
|
277
|
+
* const params = tableFromArrays({ id: [42] })
|
|
278
|
+
* const ipcData = tableToIPC(params)
|
|
279
|
+
*
|
|
280
|
+
* // Bind the parameters
|
|
281
|
+
* const result = await client.bindParameters(prepared.handle, {
|
|
282
|
+
* schema: ipcData.slice(0, schemaLength), // Extract schema bytes
|
|
283
|
+
* data: ipcData.slice(schemaLength) // Extract data bytes
|
|
284
|
+
* })
|
|
285
|
+
*
|
|
286
|
+
* // Use updated handle if provided
|
|
287
|
+
* const handle = result.handle ?? prepared.handle
|
|
288
|
+
*
|
|
289
|
+
* // Execute and retrieve results
|
|
290
|
+
* const info = await client.executePreparedQuery(handle)
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
bindParameters(handle: Buffer, parameters: ParameterData, options?: CallOptions): Promise<BindParametersResult>;
|
|
100
294
|
}
|
|
101
295
|
/**
|
|
102
296
|
* Creates a new FlightSqlClient and connects to the server.
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,KAAK,WAAW,EAGhB,YAAY,EACZ,KAAK,mBAAmB,EAExB,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,KAAK,WAAW,EAGhB,YAAY,EACZ,KAAK,mBAAmB,EAExB,KAAK,UAAU,EAChB,MAAM,2BAA2B,CAAA;AAyBlC;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,CAAA;AAExD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG;IACvC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,WAAW,GAAG;IACnD;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAA;IAErB;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,MAAM,EAAE,UAAU,CAAA;IAElB;;;OAGG;IACH,IAAI,EAAE,UAAU,CAAA;CACjB,CAAA;AA4ID;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;A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
|
*/
|
|
6
6
|
import { cmdDescriptor, FlightClient, FlightError } from "@qualithm/arrow-flight-js";
|
|
7
|
-
import { CommandStatementQuery, CommandStatementUpdate, DoPutUpdateResult } from "./generated/arrow/flight/protocol/sql/FlightSql.js";
|
|
7
|
+
import { ActionClosePreparedStatementRequest, ActionCreatePreparedStatementRequest, ActionCreatePreparedStatementResult, CommandPreparedStatementQuery, CommandPreparedStatementUpdate, CommandStatementQuery, CommandStatementUpdate, DoPutPreparedStatementResult, DoPutUpdateResult } from "./generated/arrow/flight/protocol/sql/FlightSql.js";
|
|
8
8
|
/**
|
|
9
9
|
* Flight SQL type URL prefix for encoding commands in Any messages.
|
|
10
10
|
*/
|
|
11
11
|
const TYPE_URL_PREFIX = "type.googleapis.com/arrow.flight.protocol.sql";
|
|
12
|
+
/**
|
|
13
|
+
* Flight SQL action types.
|
|
14
|
+
*/
|
|
15
|
+
const ACTION_CREATE_PREPARED_STATEMENT = "CreatePreparedStatement";
|
|
16
|
+
const ACTION_CLOSE_PREPARED_STATEMENT = "ClosePreparedStatement";
|
|
12
17
|
/**
|
|
13
18
|
* Encodes a Flight SQL command as a descriptor command buffer.
|
|
14
19
|
*
|
|
@@ -66,6 +71,54 @@ function writeVarInt(buffer, offset, value) {
|
|
|
66
71
|
buffer[offset++] = value;
|
|
67
72
|
return offset;
|
|
68
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Reads a varint from a buffer.
|
|
76
|
+
*/
|
|
77
|
+
function readVarInt(buffer, offset) {
|
|
78
|
+
let value = 0;
|
|
79
|
+
let shift = 0;
|
|
80
|
+
let bytesRead = 0;
|
|
81
|
+
while (offset < buffer.length) {
|
|
82
|
+
const byte = buffer[offset++];
|
|
83
|
+
bytesRead++;
|
|
84
|
+
value |= (byte & 0x7f) << shift;
|
|
85
|
+
if ((byte & 0x80) === 0) {
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
shift += 7;
|
|
89
|
+
}
|
|
90
|
+
return { value, bytesRead };
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Unpacks a protobuf Any message and returns the contained value bytes.
|
|
94
|
+
*
|
|
95
|
+
* @param buffer - The encoded Any message
|
|
96
|
+
* @returns The value bytes from the Any message
|
|
97
|
+
*/
|
|
98
|
+
function unpackAny(buffer) {
|
|
99
|
+
// Any message format:
|
|
100
|
+
// field 1 (type_url): string - wire type 2 (length-delimited)
|
|
101
|
+
// field 2 (value): bytes - wire type 2 (length-delimited)
|
|
102
|
+
let offset = 0;
|
|
103
|
+
let valueBytes = Buffer.alloc(0);
|
|
104
|
+
while (offset < buffer.length) {
|
|
105
|
+
const tag = buffer[offset++];
|
|
106
|
+
const fieldNumber = tag >> 3;
|
|
107
|
+
const wireType = tag & 0x07;
|
|
108
|
+
if (wireType !== 2) {
|
|
109
|
+
// Skip non-length-delimited fields (not expected in Any)
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const { value: length, bytesRead } = readVarInt(buffer, offset);
|
|
113
|
+
offset += bytesRead;
|
|
114
|
+
if (fieldNumber === 2) {
|
|
115
|
+
// This is the value field
|
|
116
|
+
valueBytes = buffer.subarray(offset, offset + length);
|
|
117
|
+
}
|
|
118
|
+
offset += length;
|
|
119
|
+
}
|
|
120
|
+
return valueBytes;
|
|
121
|
+
}
|
|
69
122
|
/**
|
|
70
123
|
* Creates a command descriptor for a Flight SQL command.
|
|
71
124
|
*
|
|
@@ -138,6 +191,101 @@ export class FlightSqlClient extends FlightClient {
|
|
|
138
191
|
const descriptor = createCommandDescriptor("CommandStatementQuery", encoded);
|
|
139
192
|
return this.getFlightInfo(descriptor, options);
|
|
140
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Executes a prepared statement query and returns flight information for retrieving results.
|
|
196
|
+
*
|
|
197
|
+
* This method sends a CommandPreparedStatementQuery to the server and returns
|
|
198
|
+
* FlightInfo containing endpoints for data retrieval. Use the returned
|
|
199
|
+
* FlightInfo with `doGet()` to retrieve the actual data.
|
|
200
|
+
*
|
|
201
|
+
* @param handle - The prepared statement handle from createPreparedStatement
|
|
202
|
+
* @param options - Optional call options
|
|
203
|
+
* @returns Flight information for retrieving query results
|
|
204
|
+
* @throws {FlightError} If the query fails
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```ts
|
|
208
|
+
* const prepared = await client.createPreparedStatement("SELECT * FROM users WHERE id = ?")
|
|
209
|
+
*
|
|
210
|
+
* // Execute the prepared statement
|
|
211
|
+
* const info = await client.executePreparedQuery(prepared.handle)
|
|
212
|
+
*
|
|
213
|
+
* // Retrieve data from each endpoint
|
|
214
|
+
* for (const endpoint of info.endpoint) {
|
|
215
|
+
* for await (const data of client.doGet(endpoint.ticket!)) {
|
|
216
|
+
* // Process data
|
|
217
|
+
* }
|
|
218
|
+
* }
|
|
219
|
+
*
|
|
220
|
+
* // Clean up
|
|
221
|
+
* await client.closePreparedStatement(prepared.handle)
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
async executePreparedQuery(handle, options) {
|
|
225
|
+
const command = {
|
|
226
|
+
preparedStatementHandle: handle
|
|
227
|
+
};
|
|
228
|
+
const encoded = CommandPreparedStatementQuery.encode(command).finish();
|
|
229
|
+
const descriptor = createCommandDescriptor("CommandPreparedStatementQuery", encoded);
|
|
230
|
+
return this.getFlightInfo(descriptor, options);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Executes a prepared statement update (INSERT, UPDATE, DELETE).
|
|
234
|
+
*
|
|
235
|
+
* @param handle - The prepared statement handle from createPreparedStatement
|
|
236
|
+
* @param options - Optional call options
|
|
237
|
+
* @returns The update result containing the number of affected records
|
|
238
|
+
* @throws {FlightError} If the update fails
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```ts
|
|
242
|
+
* const prepared = await client.createPreparedStatement(
|
|
243
|
+
* "UPDATE users SET active = false WHERE id = ?"
|
|
244
|
+
* )
|
|
245
|
+
*
|
|
246
|
+
* // Execute the prepared statement
|
|
247
|
+
* const result = await client.executePreparedUpdate(prepared.handle)
|
|
248
|
+
* console.log("Rows updated:", result.recordCount)
|
|
249
|
+
*
|
|
250
|
+
* // Clean up
|
|
251
|
+
* await client.closePreparedStatement(prepared.handle)
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
async executePreparedUpdate(handle, options) {
|
|
255
|
+
const command = {
|
|
256
|
+
preparedStatementHandle: handle
|
|
257
|
+
};
|
|
258
|
+
const encoded = CommandPreparedStatementUpdate.encode(command).finish();
|
|
259
|
+
const descriptor = createCommandDescriptor("CommandPreparedStatementUpdate", encoded);
|
|
260
|
+
const stream = this.doPut(options);
|
|
261
|
+
// Send the command as the first message with descriptor
|
|
262
|
+
stream.write({
|
|
263
|
+
flightDescriptor: {
|
|
264
|
+
type: 2, // CMD
|
|
265
|
+
path: [],
|
|
266
|
+
cmd: descriptor.cmd
|
|
267
|
+
},
|
|
268
|
+
dataHeader: Buffer.alloc(0),
|
|
269
|
+
appMetadata: Buffer.alloc(0),
|
|
270
|
+
dataBody: Buffer.alloc(0)
|
|
271
|
+
});
|
|
272
|
+
stream.end();
|
|
273
|
+
// Collect results
|
|
274
|
+
const results = await stream.collectResults();
|
|
275
|
+
const firstResult = results.at(0);
|
|
276
|
+
if (!firstResult) {
|
|
277
|
+
throw new FlightError("no result returned from prepared update", "INTERNAL");
|
|
278
|
+
}
|
|
279
|
+
// Decode the DoPutUpdateResult from appMetadata
|
|
280
|
+
const { appMetadata } = firstResult;
|
|
281
|
+
if (appMetadata.length === 0) {
|
|
282
|
+
throw new FlightError("prepared update result missing app metadata", "INTERNAL");
|
|
283
|
+
}
|
|
284
|
+
const updateResult = DoPutUpdateResult.decode(appMetadata);
|
|
285
|
+
return {
|
|
286
|
+
recordCount: updateResult.recordCount
|
|
287
|
+
};
|
|
288
|
+
}
|
|
141
289
|
/**
|
|
142
290
|
* Executes a SQL update statement (INSERT, UPDATE, DELETE).
|
|
143
291
|
*
|
|
@@ -190,6 +338,167 @@ export class FlightSqlClient extends FlightClient {
|
|
|
190
338
|
recordCount: updateResult.recordCount
|
|
191
339
|
};
|
|
192
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* Creates a prepared statement for the given SQL query.
|
|
343
|
+
*
|
|
344
|
+
* The returned handle can be used to execute the query multiple times
|
|
345
|
+
* with different parameters. The prepared statement should be closed
|
|
346
|
+
* when no longer needed using `closePreparedStatement()`.
|
|
347
|
+
*
|
|
348
|
+
* @param query - The SQL query to prepare
|
|
349
|
+
* @param options - Optional options including transaction ID
|
|
350
|
+
* @returns The prepared statement result containing the handle and schemas
|
|
351
|
+
* @throws {FlightError} If the preparation fails
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```ts
|
|
355
|
+
* const prepared = await client.createPreparedStatement(
|
|
356
|
+
* "SELECT * FROM users WHERE id = ?"
|
|
357
|
+
* )
|
|
358
|
+
*
|
|
359
|
+
* // Use prepared.handle with executePreparedQuery
|
|
360
|
+
* // ...
|
|
361
|
+
*
|
|
362
|
+
* // Clean up when done
|
|
363
|
+
* await client.closePreparedStatement(prepared.handle)
|
|
364
|
+
* ```
|
|
365
|
+
*/
|
|
366
|
+
async createPreparedStatement(query, options) {
|
|
367
|
+
const request = {
|
|
368
|
+
query,
|
|
369
|
+
transactionId: options?.transactionId
|
|
370
|
+
};
|
|
371
|
+
const encoded = ActionCreatePreparedStatementRequest.encode(request).finish();
|
|
372
|
+
const typeUrl = `${TYPE_URL_PREFIX}.ActionCreatePreparedStatementRequest`;
|
|
373
|
+
const body = packAny(typeUrl, encoded);
|
|
374
|
+
const action = {
|
|
375
|
+
type: ACTION_CREATE_PREPARED_STATEMENT,
|
|
376
|
+
body
|
|
377
|
+
};
|
|
378
|
+
// Execute the action and collect the first result
|
|
379
|
+
let resultBody;
|
|
380
|
+
for await (const result of this.doAction(action, options)) {
|
|
381
|
+
resultBody = result.body;
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
if (!resultBody || resultBody.length === 0) {
|
|
385
|
+
throw new FlightError("no result returned from create prepared statement", "INTERNAL");
|
|
386
|
+
}
|
|
387
|
+
// Unpack the Any message and decode the result
|
|
388
|
+
const valueBytes = unpackAny(resultBody);
|
|
389
|
+
const preparedResult = ActionCreatePreparedStatementResult.decode(valueBytes);
|
|
390
|
+
return {
|
|
391
|
+
handle: Buffer.from(preparedResult.preparedStatementHandle),
|
|
392
|
+
datasetSchema: Buffer.from(preparedResult.datasetSchema),
|
|
393
|
+
parameterSchema: Buffer.from(preparedResult.parameterSchema)
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Closes a prepared statement and releases server resources.
|
|
398
|
+
*
|
|
399
|
+
* @param handle - The prepared statement handle to close
|
|
400
|
+
* @param options - Optional call options
|
|
401
|
+
* @throws {FlightError} If closing fails
|
|
402
|
+
*
|
|
403
|
+
* @example
|
|
404
|
+
* ```ts
|
|
405
|
+
* const prepared = await client.createPreparedStatement("SELECT * FROM users")
|
|
406
|
+
* // ... use the prepared statement ...
|
|
407
|
+
* await client.closePreparedStatement(prepared.handle)
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
async closePreparedStatement(handle, options) {
|
|
411
|
+
const request = {
|
|
412
|
+
preparedStatementHandle: handle
|
|
413
|
+
};
|
|
414
|
+
const encoded = ActionClosePreparedStatementRequest.encode(request).finish();
|
|
415
|
+
const typeUrl = `${TYPE_URL_PREFIX}.ActionClosePreparedStatementRequest`;
|
|
416
|
+
const body = packAny(typeUrl, encoded);
|
|
417
|
+
const action = {
|
|
418
|
+
type: ACTION_CLOSE_PREPARED_STATEMENT,
|
|
419
|
+
body
|
|
420
|
+
};
|
|
421
|
+
// Execute the action - no result expected
|
|
422
|
+
for await (const _ of this.doAction(action, options)) {
|
|
423
|
+
// Consume any results (usually none for close)
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Binds parameter values to a prepared statement.
|
|
428
|
+
*
|
|
429
|
+
* Parameter values are sent as Arrow IPC data matching the parameter schema
|
|
430
|
+
* from the prepared statement. After binding, call `executePreparedQuery()`
|
|
431
|
+
* or `executePreparedUpdate()` to execute with the bound parameters.
|
|
432
|
+
*
|
|
433
|
+
* @param handle - The prepared statement handle
|
|
434
|
+
* @param parameters - The parameter data as Arrow IPC bytes
|
|
435
|
+
* @param options - Optional call options
|
|
436
|
+
* @returns Result containing an optional updated handle
|
|
437
|
+
* @throws {FlightError} If binding fails
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* ```ts
|
|
441
|
+
* import { tableToIPC, tableFromArrays } from "apache-arrow"
|
|
442
|
+
*
|
|
443
|
+
* const prepared = await client.createPreparedStatement(
|
|
444
|
+
* "SELECT * FROM users WHERE id = ?"
|
|
445
|
+
* )
|
|
446
|
+
*
|
|
447
|
+
* // Create parameter data as Arrow IPC
|
|
448
|
+
* const params = tableFromArrays({ id: [42] })
|
|
449
|
+
* const ipcData = tableToIPC(params)
|
|
450
|
+
*
|
|
451
|
+
* // Bind the parameters
|
|
452
|
+
* const result = await client.bindParameters(prepared.handle, {
|
|
453
|
+
* schema: ipcData.slice(0, schemaLength), // Extract schema bytes
|
|
454
|
+
* data: ipcData.slice(schemaLength) // Extract data bytes
|
|
455
|
+
* })
|
|
456
|
+
*
|
|
457
|
+
* // Use updated handle if provided
|
|
458
|
+
* const handle = result.handle ?? prepared.handle
|
|
459
|
+
*
|
|
460
|
+
* // Execute and retrieve results
|
|
461
|
+
* const info = await client.executePreparedQuery(handle)
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
async bindParameters(handle, parameters, options) {
|
|
465
|
+
const command = {
|
|
466
|
+
preparedStatementHandle: handle
|
|
467
|
+
};
|
|
468
|
+
const encoded = CommandPreparedStatementQuery.encode(command).finish();
|
|
469
|
+
const descriptor = createCommandDescriptor("CommandPreparedStatementQuery", encoded);
|
|
470
|
+
const stream = this.doPut(options);
|
|
471
|
+
// Send the command with schema in the first message
|
|
472
|
+
stream.write({
|
|
473
|
+
flightDescriptor: {
|
|
474
|
+
type: 2, // CMD
|
|
475
|
+
path: [],
|
|
476
|
+
cmd: descriptor.cmd
|
|
477
|
+
},
|
|
478
|
+
dataHeader: Buffer.from(parameters.schema),
|
|
479
|
+
appMetadata: Buffer.alloc(0),
|
|
480
|
+
dataBody: Buffer.from(parameters.data)
|
|
481
|
+
});
|
|
482
|
+
stream.end();
|
|
483
|
+
// Collect results
|
|
484
|
+
const results = await stream.collectResults();
|
|
485
|
+
const firstResult = results.at(0);
|
|
486
|
+
// Server may not return any result (legacy behavior)
|
|
487
|
+
if (!firstResult || firstResult.appMetadata.length === 0) {
|
|
488
|
+
return {};
|
|
489
|
+
}
|
|
490
|
+
// Decode the DoPutPreparedStatementResult from appMetadata
|
|
491
|
+
const anyBytes = unpackAny(firstResult.appMetadata);
|
|
492
|
+
if (anyBytes.length === 0) {
|
|
493
|
+
return {};
|
|
494
|
+
}
|
|
495
|
+
const bindResult = DoPutPreparedStatementResult.decode(anyBytes);
|
|
496
|
+
return {
|
|
497
|
+
handle: bindResult.preparedStatementHandle
|
|
498
|
+
? Buffer.from(bindResult.preparedStatementHandle)
|
|
499
|
+
: undefined
|
|
500
|
+
};
|
|
501
|
+
}
|
|
193
502
|
}
|
|
194
503
|
/**
|
|
195
504
|
* Creates a new FlightSqlClient and connects to the server.
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAGL,aAAa,EACb,YAAY,EAEZ,WAAW,EAEZ,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,oDAAoD,CAAA;AAE3D;;GAEG;AACH,MAAM,eAAe,GAAG,+CAA+C,CAAA;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"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I,CAAC;SACvC,CAAC,CAAA;QAEF,MAAM,CAAC,GAAG,EAAE,CAAA;QAEZ,kBAAkB;QAClB,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,cAAc,EAAE,CAAA;QAC7C,MAAM,WAAW,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAEjC,qDAAqD;QACrD,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzD,OAAO,EAAE,CAAA;QACX,CAAC;QAED,2DAA2D;QAC3D,MAAM,QAAQ,GAAG,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;QACnD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,EAAE,CAAA;QACX,CAAC;QAED,MAAM,UAAU,GAAG,4BAA4B,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAEhE,OAAO;YACL,MAAM,EAAE,UAAU,CAAC,uBAAuB;gBACxC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC;gBACjD,CAAC,CAAC,SAAS;SACd,CAAA;IACH,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,OAA+B;IAE/B,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAA;IAC3C,MAAM,MAAM,CAAC,OAAO,EAAE,CAAA;IACtB,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
9
|
-
export type { FlightSqlClientOptions, QueryOptions, UpdateResult } from "./client.js";
|
|
9
|
+
export type { BindParametersResult, FlightSqlClientOptions, ParameterData, PreparedStatementOptions, PreparedStatementResult, QueryOptions, UpdateResult } from "./client.js";
|
|
10
10
|
export { createFlightSqlClient, FlightSqlClient } from "./client.js";
|
|
11
11
|
export type { ResultIteratorOptions } from "./results.js";
|
|
12
12
|
export { flightInfoToTable, iterateResults, queryToTable, ticketToTable } from "./results.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACb,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAGpE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAG7F,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,WAAW,EACX,KAAK,UAAU,EACf,KAAK,MAAM,EACZ,MAAM,2BAA2B,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAIpE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE7F,qDAAqD;AACrD,OAAO,EAIL,WAAW,EAGZ,MAAM,2BAA2B,CAAA"}
|