Skip to content

Commit

Permalink
Enhance compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
manyuanrong committed Aug 5, 2019
1 parent ec3c008 commit 1afa226
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export type ExecuteResult = {
export class Connection {
state: ConnectionState = ConnectionState.CONNECTING;
capabilities: number = 0;
serverVersion: string;

private conn: Deno.Conn;

Expand All @@ -50,6 +51,7 @@ export class Connection {
});
await new SendPacket(data, 0x1).send(this.conn);
this.state = ConnectionState.CONNECTING;
this.serverVersion = handshakePacket.serverVersion;
this.capabilities = handshakePacket.serverCapabilities;

receive = await this.nextPacket();
Expand Down Expand Up @@ -156,11 +158,11 @@ export class Connection {
}

const rows = [];
receive = await this.nextPacket(); // EOF(less than 5.7)
if (receive.type == "RESULT") {
const row = parseRow(receive.body, fields);
rows.push(row);
if (this.serverVersion < "5.7.0") {
// EOF(less than 5.7)
receive = await this.nextPacket();
}

while (true) {
receive = await this.nextPacket();
if (receive.type === "EOF") {
Expand Down

0 comments on commit 1afa226

Please sign in to comment.