Skip to content

Commit d9d45f1

Browse files
authored
Merge branch 'trunk' into dependabot/npm_and_yarn/test/apps/vercel-nextjs/npm_and_yarn-58eae9592b
2 parents fd96608 + 7d7b99c commit d9d45f1

7 files changed

Lines changed: 804 additions & 1320 deletions

File tree

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ main();
6767

6868
The SpiceClient automatically selects the best available transport protocol in this order:
6969

70-
1. **Arrow Flight SQL** - gRPC protocol with parameter substitution
70+
1. **Arrow Flight SQL** - gRPC protocol with server-side parameter binding
7171
2. **HTTP/HTTPS** - Fallback for browser environments or when Flight is unavailable
7272

7373
For parameterized queries, the SDK provides secure parameter binding:
@@ -739,17 +739,30 @@ const table = await client.sql(
739739
console.table(table.toArray());
740740
```
741741

742+
Named parameters work too, using `$name` placeholders:
743+
744+
```js
745+
const table = await client.sql(
746+
'SELECT * FROM taxi_trips WHERE passenger_count = $passengers LIMIT 10',
747+
{ parameters: { passengers: 2 } },
748+
);
749+
```
750+
742751
**Transport Hierarchy:**
743752

744753
When parameters are provided, the SDK automatically:
745754

746-
1. **Uses Flight SQL** - Client-side parameter substitution with Arrow Flight
755+
1. **Uses Flight SQL** - Binds parameters server-side via a prepared statement
747756
2. **Falls back to HTTP** - Sends parameters as JSON if Flight is unavailable
748757

758+
Both paths bind on the server: values travel separately from the SQL text, as a typed
759+
Arrow record batch over Flight or as JSON over HTTP. Nothing is substituted into the
760+
query string on the client.
761+
749762
**Key benefits:**
750763

751-
- **SQL Injection Prevention**: Parameters are properly escaped and validated
752-
- **Type Safety**: Parameters maintain their data types
764+
- **SQL Injection Prevention**: Values are bound, never concatenated into the SQL text
765+
- **Type Safety**: Parameters keep their declared Arrow types end to end
753766
- **Automatic fallback**: Works in all environments (Node.js and browser)
754767

755768
For more information, see [docs/PARAMETERIZED_QUERIES.md](./docs/PARAMETERIZED_QUERIES.md).

package-lock.json

Lines changed: 36 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"devDependencies": {
4545
"@types/jest": "^30.0.0",
46-
"@types/node": "^18.19.130",
46+
"@types/node": "^25.0.9",
4747
"@typescript-eslint/eslint-plugin": "^8.46.2",
4848
"@typescript-eslint/parser": "^8.46.2",
4949
"dotenv": "^17.2.3",

0 commit comments

Comments
 (0)