diff --git a/package.json b/package.json index d64a02f4..ab47a61b 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,11 @@ "description": "Page size for Schema browser", "default": 500 }, + "vscode-db2i.collapsedResultSet": { + "type": "boolean", + "description": "Make larger cells collapsed by default", + "default": false + }, "vscode-db2i.alwaysStartSQLJob": { "type": "string", "description": "Name of configuration to use when auto starting a job. 'new' for brand new default job, 'ask' to be asked, 'never' to never start, or a name of a stored configuration", diff --git a/src/connection/query.ts b/src/connection/query.ts index b3ea0963..d3e58871 100644 --- a/src/connection/query.ts +++ b/src/connection/query.ts @@ -1,7 +1,6 @@ -import { changedCache} from "../language/providers/completionItemCache"; -import Document from "../language/sql/document"; + import { SQLJob } from "./sqlJob"; -import { CLCommandResult, JobLogEntry, QueryOptions, QueryResult, ServerResponse } from "./types"; +import { QueryOptions, QueryResult } from "./types"; export enum QueryState { NOT_YET_RUN = 1, RUN_MORE_DATA_AVAILABLE = 2, @@ -95,7 +94,14 @@ export class Query { if (queryResult.success !== true && !this.isCLCommand) { this.state = QueryState.ERROR; - throw new Error(queryResult.error || `Failed to run query (unknown error)`); + + let errorList = [queryResult.error, queryResult.sql_state, queryResult.sql_rc].filter(e => e !== undefined); + + if (errorList.length === 0) { + errorList.push(`Failed to run query (unknown error)`); + } + + throw new Error(errorList.join(', ')); } this.correlationId = queryResult.id; diff --git a/src/connection/types.ts b/src/connection/types.ts index 4d56358a..4146da23 100644 --- a/src/connection/types.ts +++ b/src/connection/types.ts @@ -1,9 +1,9 @@ -import { Server } from "http"; - export interface ServerResponse { id: string; success: boolean; error?: string; + sql_rc: number; + sql_state: string; } export interface ConnectionResult extends ServerResponse { diff --git a/src/views/html.ts b/src/views/html.ts index a566cde2..05d5a973 100644 --- a/src/views/html.ts +++ b/src/views/html.ts @@ -1,5 +1,6 @@ -export const head = /*html*/` +export function getHeader(options: {withCollapsed?: boolean} = {}): string { + return /*html*/` `; - + + `; +} export const escapeHTML = str => str.replace(/[&<>'"]/g, tag => ({ diff --git a/src/views/jobManager/jobLog.ts b/src/views/jobManager/jobLog.ts index aa9f5617..55e86b58 100644 --- a/src/views/jobManager/jobLog.ts +++ b/src/views/jobManager/jobLog.ts @@ -1,6 +1,6 @@ import { ViewColumn, window } from "vscode"; import { JobInfo } from "../../connection/manager"; -import { escapeHTML, head } from "../html"; +import { escapeHTML, getHeader } from "../html"; import { JobLogEntry } from "../../connection/types"; import { JobManager } from "../../config"; @@ -22,7 +22,7 @@ function generatePage(rows: JobLogEntry[]) { - ${head} + ${getHeader()} diff --git a/src/views/results/html.ts b/src/views/results/html.ts index fcfe4d52..07b3a83e 100644 --- a/src/views/results/html.ts +++ b/src/views/results/html.ts @@ -1,5 +1,7 @@ import { Webview } from "vscode"; -import { head } from "../html"; +import { getHeader } from "../html"; + +import Configuration from "../../configuration"; export function setLoadingText(webview: Webview, text: string) { webview.postMessage({ @@ -13,7 +15,7 @@ export function getLoadingHTML(): string { - ${head} + ${getHeader()}