executeMultiStatementExtended handles execution of multi-statement query rewrites for the extended query protocol (Parse/Bind/Execute). Unlike executeMultiStatement, this does NOT send ReadyForQuery (that's done by Sync).
(statements []string, cleanup []string, args []interface{}, resultFormats []int16, described bool)
| 905 | rows, err = retryOnConflict(runQuery) |
| 906 | } |
| 907 | if err != nil { |
| 908 | rows, err, _ = recoverAbortedTransaction( |
| 909 | err, |
| 910 | c.txStatus == txStatusIdle, |
| 911 | func() error { |
| 912 | _, rollbackErr := c.executor.ExecContext(context.Background(), "ROLLBACK") |
| 913 | return rollbackErr |
| 914 | }, |
| 915 | runQuery, |
| 916 | ) |
| 917 | } |
| 918 | if err != nil { |
| 919 | queryFinalErr = err |
| 920 | errCode := classifyErrorCode(err) |
| 921 | errMsg := err.Error() |
| 922 | if c.isCallerCancellation(err) { |
| 923 | errCode = "57014" |
| 924 | errMsg = c.cancellationMessage(err) |
| 925 | } else { |
| 926 | c.logQueryError(executedQuery, err) |
| 927 | } |
| 928 | c.sendError("ERROR", errCode, errMsg) |
| 929 | c.setTxError() |
| 930 | c.logQuery(start, query, executedQuery, cmdType, 0, 0, errCode, errMsg, "simple-batch") |
| 931 | return true, nil |
| 932 | } |
| 933 | defer func() { _ = rows.Close() }() |
| 934 | |
| 935 | cols, err := rows.Columns() |
| 936 | if err != nil { |
| 937 | queryFinalErr = err |
| 938 | c.sendError("ERROR", "42000", err.Error()) |
| 939 | c.setTxError() |
| 940 | return true, nil |
| 941 | } |
| 942 | |
| 943 | colTypes, err := rows.ColumnTypes() |
| 944 | if err != nil { |
| 945 | queryFinalErr = err |
| 946 | c.sendError("ERROR", "42000", err.Error()) |
| 947 | c.setTxError() |
| 948 | return true, nil |
| 949 | } |
| 950 | |
| 951 | if err := c.sendRowDescription(cols, colTypes); err != nil { |
| 952 | queryFinalErr = err |
| 953 | return false, err |
| 954 | } |
| 955 | |
| 956 | // Extract type OIDs for JSON-aware text formatting |
| 957 | typeOIDs := make([]int32, len(colTypes)) |
| 958 | for i, ct := range colTypes { |
| 959 | typeOIDs[i] = getTypeInfo(ct).OID |
| 960 | } |
| 961 | |
| 962 | rowCount := 0 |
| 963 | for rows.Next() { |
| 964 | values := make([]interface{}, len(cols)) |
no test coverage detected