MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / HandleStmtExecute

Method HandleStmtExecute

IceFireDB-SQLProxy/internal/mysql/handle.go:57–77  ·  view source on GitHub ↗
(c *server.Conn, context any, query string, args []any)

Source from the content-addressed store, hash-verified

55}
56
57func (h *Handle) HandleStmtExecute(c *server.Conn, context any, query string, args []any) (*mysql.Result, error) {
58 // Check if this is a readonly connection attempting a write
59 if h.conn.GetUser() == config.Get().Mysql.Readonly.User && isDML(query) {
60 return nil, errors.New("readonly user cannot execute write operations")
61 }
62
63 stmt, ok := context.(*client.Stmt)
64 if !ok {
65 return nil, errors.New("other error")
66 }
67 res, err := stmt.Execute(args...)
68 if err == nil && isDML(query) {
69 // Determine access type based on connection user
70 accessType := "admin"
71 if h.conn.GetUser() == config.Get().Mysql.Readonly.User {
72 accessType = "readonly"
73 }
74 broadcast(query, accessType)
75 }
76 return res, err
77}
78
79func (h *Handle) HandleStmtClose(c *server.Conn, context any) error {
80 stmt, ok := context.(*client.Stmt)

Callers

nothing calls this directly

Calls 5

GetFunction · 0.92
broadcastFunction · 0.85
isDMLFunction · 0.70
ExecuteMethod · 0.65
GetUserMethod · 0.45

Tested by

no test coverage detected