mirror of
https://github.com/oven-sh/bun
synced 2026-02-19 23:31:45 +00:00
fix(Bun.SQL) fix MySQL execution on windows (#22696)
### What does this PR do? Fixes https://github.com/oven-sh/bun/issues/22695 Fixes https://github.com/oven-sh/bun/issues/22654 ### How did you verify your code works? Added mysql:9 + run mysql tests on windows <img width="1035" height="708" alt="489727987-3cca2da4-0ff8-4b4a-b5be-9fbdd1c9862d" src="https://github.com/user-attachments/assets/02c6880d-547e-43b5-8af8-0b7c895c6166" />
This commit is contained in:
@@ -304,19 +304,19 @@ fn SocketHandler(comptime ssl: bool) type {
|
||||
}
|
||||
|
||||
fn updateReferenceType(this: *@This()) void {
|
||||
if (this.#js_value.isNotEmpty()) {
|
||||
if (this.#connection.isActive()) {
|
||||
if (this.#js_value == .weak) {
|
||||
this.#js_value.upgrade(this.#globalObject);
|
||||
this.#poll_ref.ref(this.#vm);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.#js_value == .strong) {
|
||||
this.#js_value.downgrade();
|
||||
this.#poll_ref.unref(this.#vm);
|
||||
return;
|
||||
if (this.#connection.isActive()) {
|
||||
debug("connection is active", .{});
|
||||
if (this.#js_value.isNotEmpty() and this.#js_value == .weak) {
|
||||
debug("strong ref", .{});
|
||||
this.#js_value.upgrade(this.#globalObject);
|
||||
}
|
||||
this.#poll_ref.ref(this.#vm);
|
||||
return;
|
||||
}
|
||||
debug("connection is not active", .{});
|
||||
if (this.#js_value.isNotEmpty() and this.#js_value == .strong) {
|
||||
debug("week ref", .{});
|
||||
this.#js_value.downgrade();
|
||||
}
|
||||
this.#poll_ref.unref(this.#vm);
|
||||
}
|
||||
@@ -589,10 +589,10 @@ pub fn getQueriesArray(this: *@This()) JSValue {
|
||||
return .js_undefined;
|
||||
}
|
||||
|
||||
pub inline fn isAbleToWrite(this: *@This()) bool {
|
||||
pub inline fn isAbleToWrite(this: *const @This()) bool {
|
||||
return this.#connection.isAbleToWrite();
|
||||
}
|
||||
pub inline fn isConnected(this: *@This()) bool {
|
||||
pub inline fn isConnected(this: *const @This()) bool {
|
||||
return this.#connection.status == .connected;
|
||||
}
|
||||
pub inline fn canPipeline(this: *@This()) bool {
|
||||
@@ -662,10 +662,7 @@ pub fn onConnectionEstabilished(this: *@This()) void {
|
||||
on_connect.ensureStillAlive();
|
||||
var js_value = this.#js_value.tryGet() orelse .js_undefined;
|
||||
js_value.ensureStillAlive();
|
||||
// this.#globalObject.queueMicrotask(on_connect, &[_]JSValue{ JSValue.jsNull(), js_value });
|
||||
const loop = this.#vm.eventLoop();
|
||||
loop.runCallback(on_connect, this.#globalObject, .js_undefined, &[_]JSValue{ JSValue.jsNull(), js_value });
|
||||
this.#poll_ref.unref(this.#vm);
|
||||
this.#globalObject.queueMicrotask(on_connect, &[_]JSValue{ JSValue.jsNull(), js_value });
|
||||
}
|
||||
pub fn onQueryResult(this: *@This(), request: *JSMySQLQuery, result: MySQLQueryResult) void {
|
||||
request.resolve(this.getQueriesArray(), result);
|
||||
|
||||
Reference in New Issue
Block a user