@@ -67,7 +67,7 @@ main();
6767
6868The 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
71712 . ** HTTP/HTTPS** - Fallback for browser environments or when Flight is unavailable
7272
7373For parameterized queries, the SDK provides secure parameter binding:
@@ -739,17 +739,30 @@ const table = await client.sql(
739739console .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
744753When 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
7477562 . ** 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
755768For more information, see [ docs/PARAMETERIZED_QUERIES.md] ( ./docs/PARAMETERIZED_QUERIES.md ) .
0 commit comments