@asla/yoursql 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ class DbPoolTransaction extends DbQuery {
24
24
  .then((conn) => {
25
25
  this.#conn = conn;
26
26
  const begin = "BEGIN" + (this.mode ? " TRANSACTION ISOLATION LEVEL " + this.mode : "");
27
- const promise = conn.multipleQuery([begin, sql]);
27
+ const promise = conn.multipleQuery(sql instanceof Array ? [begin, ...sql] : [begin, sql]);
28
28
  this.#pending = promise;
29
29
  this.#query = this.#queryAfter;
30
30
  return promise;
@@ -17,16 +17,11 @@ export declare abstract class DbQuery implements DbQueryBase {
17
17
  /** 单语句查询,只返回第一行。如果查询没有返回行,则抛出异常。 */
18
18
  queryFirstRow<T = any>(sql: SqlStatementDataset<T>): Promise<T>;
19
19
  queryFirstRow<T = any>(sql: SqlLike): Promise<T>;
20
- /**
21
- * 查询行
22
- * 不应查询单条语句,否则返回错误值
23
- */
24
- multipleQueryRows<T extends any[] = any[]>(sql: SqlStatementDataset<T>): Promise<T[]>;
25
20
  /**
26
21
  * 查询行
27
22
  * 不应查询单语句,否则返回错误值
28
23
  */
29
- multipleQueryRows<T extends any[] = any[]>(sql: SqlLike): Promise<T[]>;
24
+ multipleQueryRows<T extends any[] = any[]>(sql: SqlLike | SqlLike[]): Promise<T[]>;
30
25
  /**
31
26
  * 指定某一列为key,返回 key 到 row 的映射
32
27
  * 单语句查询,不应查询多语句,否则返回错误值
@@ -21,6 +21,10 @@ class DbQuery {
21
21
  return rows[0];
22
22
  });
23
23
  }
24
+ /**
25
+ * 查询行
26
+ * 不应查询单语句,否则返回错误值
27
+ */
24
28
  multipleQueryRows(sql) {
25
29
  return this.multipleQuery(sql).then((res) => res.map((item) => item.rows ?? []));
26
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asla/yoursql",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "types": "./dist/mod.d.ts",