@pi-r/mysql 0.2.3 → 0.2.5

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.
Files changed (2) hide show
  1. package/client/index.js +11 -5
  2. package/package.json +1 -1
package/client/index.js CHANGED
@@ -312,12 +312,18 @@ async function executeBatchQuery(batch, options = '', outResult) {
312
312
  mysqlClient = undefined;
313
313
  }
314
314
  commandType = this.commandType.SELECT;
315
- const [rows] = await client.query(query, params);
315
+ let [rows] = await client.query(query, params);
316
316
  this.add(item, 4 /* DB_TRANSACTION.COMMIT */);
317
- resolve(Array.isArray(rows) && !rows.some(row => {
318
- const name = row.constructor.name;
319
- return name === 'ResultSetHeader' || name === 'OkPacket';
320
- }) ? this.setQueryResult(source, removePoolProperties(credential), queryString, rows, cacheValue) : null);
317
+ if (Array.isArray(rows)) {
318
+ if (rows.length === 2 && Array.isArray(rows[0]) && !Array.isArray(rows[0])) {
319
+ rows = rows[0];
320
+ }
321
+ rows = rows.filter(row => Array.isArray(row) || !('affectedRows' in row && 'fieldCount' in row && 'serverStatus' in row));
322
+ resolve((0, types_1.isArray)(rows) ? this.setQueryResult(source, removePoolProperties(credential), queryString, rows, cacheValue) : null);
323
+ }
324
+ else {
325
+ resolve(null);
326
+ }
321
327
  }
322
328
  }
323
329
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/mysql",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "MySQL client driver for E-mc.",
5
5
  "main": "client/index.js",
6
6
  "types": "client/index.d.ts",