Skip to content

Commit 5e5e959

Browse files
committed
send prepare/execute statements down the proper listener
1 parent 2b11f29 commit 5e5e959

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/commands/server_handshake.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,13 @@ class ServerHandshake extends Command {
122122
case CommandCode.QUERY:
123123
if (connection.listeners('query').length) {
124124
const query = packet.readString(undefined, encoding);
125-
connection.emit('query', query);
125+
if (this._isStatement(query, 'PREPARE') || this._isStatement(query, 'SET')) {
126+
connection.emit('stmt_prepare', query);
127+
}
128+
else if (this._isStatement(query, 'EXECUTE')) {
129+
connection.emit('stmt_execute', null, null, null, null, query);
130+
}
131+
else connection.emit('query', query);
126132
} else {
127133
connection.writeError({
128134
code: Errors.HA_ERR_INTERNAL_ERROR,

0 commit comments

Comments
 (0)