denodrivers / mysql

MySQL driver for Deno
https://deno-mysql.netlify.com/
MIT License
260 stars 65 forks source link

Enhancement CLIENT_DEPRECATE_EOF #140

Closed shiyuhang0 closed 2 years ago

shiyuhang0 commented 2 years ago

Optimize https://github.com/denodrivers/mysql/pull/139

when CLIENT_DEPRECATE_EOF is set. EOF_Packet can also be Ok_Packet.

https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_query_response_text_resultset.html

shiyuhang0 commented 2 years ago

I also have a question about this code in connection.ts

  this.capabilities = handshakePacket.serverCapabilities;

The capabilities should be handshakePacket.serverCapabilities or HandshakeResponse's client_flag?

shiyuhang0 commented 2 years ago

@lideming PTAL

lideming commented 2 years ago

But I wonder why it works without this change.

The capabilities should be handshakePacket.serverCapabilities or HandshakeResponse's client_flag?

I think both should work. As we response with the flags that server advertised and client recognized.

shiyuhang0 commented 2 years ago

Because we judge EOF package by 0xFE. And OK packet can be either 0x00 or 0xFE. When the client and server both support CLIENT_DEPRECATE_EOF, serve will send OK packet. If it is 0xFE ,it happens to work. But if it is 0x00, I think we can't work.