Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gajus/slonik
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v31.4.1
Choose a base ref
...
head repository: gajus/slonik
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v31.4.2
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on Oct 20, 2022

  1. fix: refactor map to for..of

    gajus committed Oct 20, 2022
    Copy the full SHA
    7bd881a View commit details
  2. fix: refactor map to for..of

    gajus committed Oct 20, 2022
    Copy the full SHA
    0628b24 View commit details
  3. fix: refactor map to for..of

    gajus committed Oct 20, 2022
    Copy the full SHA
    7ea1610 View commit details
Showing with 24 additions and 13 deletions.
  1. +13 −6 src/connectionMethods/query.ts
  2. +11 −7 src/routines/executeQuery.ts
19 changes: 13 additions & 6 deletions src/connectionMethods/query.ts
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import {
executeQuery,
} from '../routines';
import {
type Field,
type InternalQueryMethod,
type Notice,
type QueryResult,
@@ -30,14 +31,20 @@ export const query: InternalQueryMethod = async (
finalValues as any[],
);

return {
command: result.command as QueryResult<unknown>['command'],
fields: (result.fields || []).map((field) => {
return {
const fields: Field[] = [];

if (result.fields) {
for (const field of result.fields) {
fields.push({
dataTypeId: field.dataTypeID,
name: field.name,
};
}),
});
}
}

return {
command: result.command as QueryResult<unknown>['command'],
fields,
notices: result.notices ?? [],
rowCount: result.rowCount || 0,
rows: result.rows || [],
18 changes: 11 additions & 7 deletions src/routines/executeQuery.ts
Original file line number Diff line number Diff line change
@@ -185,14 +185,16 @@ export const executeQuery = async (
if (clientConfiguration.captureStackTrace) {
const callSites = await getStackTrace();

stackTrace = callSites.map((callSite) => {
return {
stackTrace = [];

for (const callSite of callSites) {
stackTrace.push({
columnNumber: callSite.columnNumber,
fileName: callSite.fileName,
functionName: callSite.functionName,
lineNumber: callSite.lineNumber,
};
});
});
}
}

const queryId = inheritedQueryId ?? createQueryId();
@@ -401,9 +403,11 @@ export const executeQuery = async (
fields,
} = result;

const rows: readonly QueryResultRow[] = result.rows.map((row) => {
return transformRow(executionContext, actualQuery, row, fields);
});
const rows: QueryResultRow[] = [];

for (const row of result.rows) {
rows.push(transformRow(executionContext, actualQuery, row, fields));
}

result = {
...result,