MCPcopy Create free account
hub / github.com/apecloud/myduckserver / handleMessage

Method handleMessage

pgserver/connection_handler.go:411–446  ·  view source on GitHub ↗

handleMessages processes the message provided and returns status flags indicating what the connection should do next. If the |stop| response parameter is true, it indicates that the connection should be closed by the caller. If the |endOfMessages| response parameter is true, it indicates that no mor

(msg pgproto3.Message)

Source from the content-addressed store, hash-verified

409
410// handleMessages processes the message provided and returns status flags indicating what the connection should do next.
411// If the |stop| response parameter is true, it indicates that the connection should be closed by the caller. If the
412// |endOfMessages| response parameter is true, it indicates that no more messages are expected for the current operation
413// and a READY FOR QUERY message should be sent back to the client, so it can send the next query.
414func (h *ConnectionHandler) handleMessage(msg pgproto3.Message) (stop, endOfMessages bool, err error) {
415 logrus.Tracef("Handling message: %T", msg)
416 switch message := msg.(type) {
417 case *pgproto3.Terminate:
418 return true, false, nil
419 case *pgproto3.Sync:
420 h.waitForSync = false
421 return false, true, nil
422 case *pgproto3.Query:
423 endOfMessages, err = h.handleQuery(message)
424 return false, endOfMessages, err
425 case *pgproto3.Parse:
426 return false, false, h.handleParse(message)
427 case *pgproto3.Describe:
428 return false, false, h.handleDescribe(message)
429 case *pgproto3.Bind:
430 return false, false, h.handleBind(message)
431 case *pgproto3.Execute:
432 return false, false, h.handleExecute(message)
433 case *pgproto3.Close:
434 if message.ObjectType == 'S' {
435 h.deletePreparedStatement(message.Name)
436 } else {
437 h.deletePortal(message.Name)
438 }
439 return false, false, h.send(&pgproto3.CloseComplete{})
440 case *pgproto3.CopyData:
441 return h.handleCopyData(message)
442 case *pgproto3.CopyDone:
443 return h.handleCopyDone(message)
444 case *pgproto3.CopyFail:
445 return h.handleCopyFail(message)
446 default:
447 return false, true, fmt.Errorf(`unhandled message "%t"`, message)
448 }
449}

Callers 1

receiveMessageMethod · 0.95

Calls 11

handleQueryMethod · 0.95
handleParseMethod · 0.95
handleDescribeMethod · 0.95
handleBindMethod · 0.95
handleExecuteMethod · 0.95
deletePortalMethod · 0.95
sendMethod · 0.95
handleCopyDataMethod · 0.95
handleCopyDoneMethod · 0.95
handleCopyFailMethod · 0.95

Tested by

no test coverage detected