fix(Bun.SQL) handle MySQL Int24 (#22241)

### What does this PR do?
handle Int24 to be numbers
### How did you verify your code works?
tests

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Ciro Spaciari
2025-08-29 17:03:26 -07:00
committed by GitHub
parent 684f7ecd09
commit a34e10db53
4 changed files with 31 additions and 1 deletions

View File

@@ -276,6 +276,16 @@ describeWithContainer(
expect((await sql`select ${"hello"} as x`)[0].x).toBe("hello");
});
test("MediumInt/Int24", async () => {
let random_name = ("t_" + Bun.randomUUIDv7("hex").replaceAll("-", "")).toLowerCase();
await sql`CREATE TEMPORARY TABLE ${sql(random_name)} (a mediumint unsigned)`;
await sql`INSERT INTO ${sql(random_name)} VALUES (${1})`;
const result = await sql`select * from ${sql(random_name)}`;
expect(result[0].a).toBe(1);
const result2 = await sql`select * from ${sql(random_name)}`.simple();
expect(result2[0].a).toBe(1);
});
test("Boolean/TinyInt/BIT", async () => {
// Protocol will always return 0 or 1 for TRUE and FALSE when not using a table.
expect((await sql`select ${false} as x`)[0].x).toBe(0);