mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 03:48:56 +00:00
feat(MYSQL) Bun.SQL mysql support (#21968)
### What does this PR do? Add MySQL support, Refactor will be in a followup PR ### How did you verify your code works? A lot of tests --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: cirospaciari <6379399+cirospaciari@users.noreply.github.com>
This commit is contained in:
22
src/sql/mysql/MySQLContext.zig
Normal file
22
src/sql/mysql/MySQLContext.zig
Normal file
@@ -0,0 +1,22 @@
|
||||
tcp: ?*uws.SocketContext = null,
|
||||
|
||||
onQueryResolveFn: JSC.Strong.Optional = .empty,
|
||||
onQueryRejectFn: JSC.Strong.Optional = .empty,
|
||||
|
||||
pub fn init(globalObject: *JSC.JSGlobalObject, callframe: *JSC.CallFrame) bun.JSError!JSValue {
|
||||
var ctx = &globalObject.bunVM().rareData().mysql_context;
|
||||
ctx.onQueryResolveFn.set(globalObject, callframe.argument(0));
|
||||
ctx.onQueryRejectFn.set(globalObject, callframe.argument(1));
|
||||
|
||||
return .js_undefined;
|
||||
}
|
||||
|
||||
comptime {
|
||||
@export(&JSC.toJSHostFn(init), .{ .name = "MySQLContext__init" });
|
||||
}
|
||||
|
||||
const bun = @import("bun");
|
||||
const uws = bun.uws;
|
||||
|
||||
const JSC = bun.jsc;
|
||||
const JSValue = JSC.JSValue;
|
||||
Reference in New Issue
Block a user