Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Commit 71016ca

Browse files
committed
add mysql last insert id
1 parent b810ce1 commit 71016ca

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@outerbase/sdk",
3-
"version": "2.0.0-rc.5",
3+
"version": "2.0.0-rc.6",
44
"description": "",
55
"main": "dist/index.js",
66
"module": "dist/index.js",

src/connections/mongodb.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ export class MongoDBConnection implements Connection {
101101
await this.connect();
102102
await this.disconnect();
103103
return {};
104-
} catch {
104+
} catch (e) {
105+
if (e instanceof Error) {
106+
return { error: e.message };
107+
}
105108
return { error: 'Failed to connect to MongoDB' };
106109
}
107110
}

src/connections/mysql.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
FieldPacket,
3+
OkPacketParams,
34
QueryError,
45
type Connection,
56
type QueryResult as MySQLQueryResult,
@@ -225,7 +226,7 @@ export class MySQLConnection extends SqlConnection {
225226
): Promise<QueryResult<T>> {
226227
try {
227228
const { fields, rows, error } = await new Promise<{
228-
rows: MySQLQueryResult;
229+
rows: MySQLQueryResult | OkPacketParams;
229230
error: QueryError | null;
230231
fields: FieldPacket[];
231232
}>((r) =>
@@ -236,14 +237,11 @@ export class MySQLConnection extends SqlConnection {
236237
},
237238
query.parameters,
238239
(error, result, fields) => {
239-
if (Array.isArray(result)) {
240-
r({
241-
rows: (result as MySQLQueryResult) ?? [],
242-
fields: fields,
243-
error,
244-
});
245-
}
246-
return r({ rows: [], error, fields: [] });
240+
return r({
241+
rows: result,
242+
error,
243+
fields,
244+
});
247245
}
248246
)
249247
);

0 commit comments

Comments
 (0)