Skip to content

Commit

Permalink
Fix querying empty string (#163)
Browse files Browse the repository at this point in the history
* test: select empty string

* ci: disable fail-fast

* Revert "Enhancement CLIENT_DEPRECATE_EOF (#140)"
  • Loading branch information
lideming authored Sep 13, 2023
1 parent bc52b38 commit 37569ad
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
DENO_VERSION:
- v1.x
Expand Down
6 changes: 1 addition & 5 deletions src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,7 @@ export class Connection {
if (!iterator) {
while (true) {
receive = await this.nextPacket();
// OK_Packet when CLIENT_DEPRECATE_EOF is set. OK_Packet can be 0xfe or 0x00
if (
receive.type === PacketType.EOF_Packet ||
receive.type === PacketType.OK_Packet
) {
if (receive.type === PacketType.EOF_Packet) {
break;
} else {
const row = parseRow(receive.body, fields);
Expand Down
15 changes: 15 additions & 0 deletions test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,21 @@ testWithClient(async function testDropUserWithMysqlNativePassword(client) {
await client.execute(`DROP USER 'testuser'@'%'`);
});

testWithClient(async function testSelectEmptyString(client) {
assertEquals(
await client.query(`SELECT '' AS a`),
[{ a: "" }],
);
assertEquals(
await client.query(`SELECT '' AS a, '' AS b, '' AS c`),
[{ a: "", b: "", c: "" }],
);
assertEquals(
await client.query(`SELECT '' AS a, 'b' AS b, '' AS c`),
[{ a: "", b: "b", c: "" }],
);
});

registerTests();

Deno.test("configLogger()", async () => {
Expand Down

0 comments on commit 37569ad

Please sign in to comment.