You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a parameter type is not explicitly specified in a prepared statement, the type is inferred at execution time based on the provided argument. This approach helps simplify statement definitions and supports flexible query execution.
12
-
13
-
**SQL Example**
14
-
15
-
To create a prepared statement named `greater_than` that infers the type of its parameter:
16
-
17
-
```sql
18
-
PREPARE greater_than ASSELECT*FROM example WHERE a > $1;
19
-
```
20
-
21
-
To execute the prepared statement with an integer argument:
22
-
23
-
```sql
24
-
EXECUTE greater_than(20);
25
-
```
26
-
27
-
**Python Example**
28
-
29
-
```python
30
-
import adbc_driver_flightsql.dbapi
31
-
32
-
with adbc_driver_flightsql.dbapi.connect("grpc://localhost:50051") as conn:
33
-
with conn.cursor() as cur:
34
-
cur.execute("PREPARE greater_than AS SELECT * FROM example WHERE a > $1;")
35
-
cur.execute("EXECUTE greater_than(?)", (20,))
36
-
result = cur.fetchall()
37
-
print(result)
38
-
```
39
-
40
9
## Positional Arguments
41
10
42
11
Prepared statements can use positional arguments to support multiple parameters. Each parameter is referenced by its position in the statement.
0 commit comments