1
Execute Query
One script reply has been approved by the moderators Verified
Created by vivieninhittaumntuh 911 days ago Viewed 43468 times
0
Submitted by rossmccrann Deno
Verified 875 days ago
1
import { Client } from "https://deno.land/x/mysql/mod.ts";
2

3
type Mysql = {
4
  host: string;
5
  port: number;
6
  user: string;
7
  database: string;
8
  password: string;
9
  ssl: boolean;
10
};
11
export async function main(mysql_conn: Mysql, query: string) {
12
  mysql_conn.db = mysql_conn.database;
13
  mysql_conn.hostname = mysql_conn.host;
14
  mysql_conn.username = mysql_conn.user;
15

16
  const client = await new Client().connect(mysql_conn);
17

18
  return await client.execute(query);
19
}
20