interpolateArgs performs simple positional argument interpolation for Flight SQL. Flight SQL's Execute doesn't support $1-style parameters natively, so we interpolate them into the query string. Safety: args come from PostgreSQL wire protocol typed parameter binding, not raw user strings. The calle
(query string, args []any)
| 895 | if r.done && r.err == nil { |
| 896 | r.captureProfiling() |
| 897 | } |
| 898 | if r.waitForClosed != nil && (!r.done || r.err != nil) { |
| 899 | r.closeErr = r.waitForClosed() |
| 900 | } |
| 901 | }) |
| 902 | return r.closeErr |
| 903 | } |
| 904 | |
| 905 | func (r *FlightRowSet) Err() error { |
| 906 | return r.err |
| 907 | } |
| 908 | |
| 909 | // emptyRowSet is returned when a query produces no endpoints and no schema. |
| 910 | type emptyRowSet struct{} |
| 911 | |
| 912 | func (e *emptyRowSet) Columns() ([]string, error) { return nil, nil } |
| 913 | func (e *emptyRowSet) ColumnTypes() ([]sqlcore.ColumnTyper, error) { return nil, nil } |
| 914 | func (e *emptyRowSet) Next() bool { return false } |
| 915 | func (e *emptyRowSet) Scan(dest ...any) error { return fmt.Errorf("no rows") } |
| 916 | func (e *emptyRowSet) Close() error { return nil } |
| 917 | func (e *emptyRowSet) Err() error { return nil } |
| 918 | |
| 919 | // emptySchemaRowSet is returned when a query produces no data rows but does |
| 920 | // have schema information (e.g., SELECT ... LIMIT 0). This preserves column |
| 921 | // names and types for callers like COPY FROM STDIN that need to inspect the |
| 922 | // target table schema. |
| 923 | type emptySchemaRowSet struct { |
| 924 | schema *arrow.Schema |
| 925 | } |
| 926 | |
| 927 | func (e *emptySchemaRowSet) Columns() ([]string, error) { |
| 928 | cols := make([]string, e.schema.NumFields()) |
| 929 | for i := 0; i < e.schema.NumFields(); i++ { |
| 930 | cols[i] = e.schema.Field(i).Name |
| 931 | } |
| 932 | return cols, nil |
| 933 | } |
| 934 | |
| 935 | func (e *emptySchemaRowSet) ColumnTypes() ([]sqlcore.ColumnTyper, error) { |
| 936 | types := make([]sqlcore.ColumnTyper, e.schema.NumFields()) |
| 937 | for i := 0; i < e.schema.NumFields(); i++ { |
| 938 | types[i] = newArrowColumnType(e.schema.Field(i)) |
| 939 | } |
| 940 | return types, nil |
| 941 | } |
| 942 | |
| 943 | func (e *emptySchemaRowSet) Next() bool { return false } |
| 944 | func (e *emptySchemaRowSet) Scan(...any) error { return fmt.Errorf("no rows") } |
| 945 | func (e *emptySchemaRowSet) Close() error { return nil } |
| 946 | func (e *emptySchemaRowSet) Err() error { return nil } |
| 947 | |
| 948 | // flightExecResult implements ExecResult for Flight SQL updates. |
| 949 | type flightExecResult struct { |
| 950 | rowsAffected int64 |
| 951 | } |