Skip to content

Commit 52112b9

Browse files
committed
cleanup and fixes
1 parent 1dfba2b commit 52112b9

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

deno.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
"db:stop": "docker compose down --remove-orphans --volumes"
1616
},
1717
"imports": {
18-
"@halvardm/sqlx": "../deno-sqlx/mod.ts",
19-
"@halvardm/sqlx/testing": "../deno-sqlx/lib/testing.ts",
18+
"@halvardm/sqlx": "jsr:@halvardm/[email protected]",
2019
"@std/assert": "jsr:@std/assert@^0.221.0",
2120
"@std/async": "jsr:@std/async@^0.221.0",
2221
"@std/crypto": "jsr:@std/crypto@^0.221.0",

lib/client.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class MysqlQueriable extends SqlxBase implements
5353
readonly queryOptions: MysqlQueryOptions;
5454

5555
get connected(): boolean {
56-
throw new Error("Method not implemented.");
56+
return this.connection.connected;
5757
}
5858

5959
constructor(
@@ -181,9 +181,9 @@ export class MysqlPrepared extends SqlxBase implements
181181
) {
182182
super();
183183
this.connection = connection;
184-
this.#queriable = new MysqlQueriable(connection);
185184
this.sql = sql;
186185
this.queryOptions = options;
186+
this.#queriable = new MysqlQueriable(connection, this.queryOptions);
187187
}
188188

189189
execute(

lib/utils/errors.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SqlxError } from "@halvardm/sqlx";
1+
import { isSqlxError, SqlxError } from "@halvardm/sqlx";
22

33
export class MysqlError extends SqlxError {
44
constructor(msg: string) {
@@ -46,5 +46,5 @@ export class MysqlTransactionError extends MysqlError {
4646
* Check if an error is a MysqlError
4747
*/
4848
export function isMysqlError(err: unknown): err is MysqlError {
49-
return err instanceof MysqlError;
49+
return isSqlxError(err) && err instanceof MysqlError;
5050
}

lib/utils/logger.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getLogger } from "@std/log";
1+
import { getLogger, type Logger } from "@std/log";
22
import { MODULE_NAME } from "./meta.ts";
33

44
/**
@@ -7,6 +7,6 @@ import { MODULE_NAME } from "./meta.ts";
77
*
88
* @see {@link https://deno.land/std/log/mod.ts}
99
*/
10-
export function logger() {
10+
export function logger(): Logger {
1111
return getLogger(MODULE_NAME);
1212
}

lib/utils/query.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function replaceParams(
5858
})`;
5959
}
6060
case "string":
61-
return `"${escapeString(val)}"`;
61+
return `"${escapeString(val as string)}"`;
6262
case "undefined":
6363
return "NULL";
6464
case "number":

0 commit comments

Comments
 (0)