|
|
@ -6,7 +6,7 @@ import { stderr, stdout, stdoutVar } from '../shell'; |
|
|
|
|
|
|
|
|
|
|
|
const buildGetRequestHandler = |
|
|
|
const buildGetRequestHandler = |
|
|
|
( |
|
|
|
( |
|
|
|
sqlscript: string | BuildQueryFunction, |
|
|
|
scriptOrCallback: string | BuildQueryFunction, |
|
|
|
{ beforeRespond }: BuildGetRequestHandlerOptions = {}, |
|
|
|
{ beforeRespond }: BuildGetRequestHandlerOptions = {}, |
|
|
|
) => |
|
|
|
) => |
|
|
|
async (request: Request, response: Response) => { |
|
|
|
async (request: Request, response: Response) => { |
|
|
@ -17,12 +17,12 @@ const buildGetRequestHandler = |
|
|
|
let result: (number | null | string)[][]; |
|
|
|
let result: (number | null | string)[][]; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
result = await query( |
|
|
|
const sqlscript: string = |
|
|
|
call<string>(sqlscript, { |
|
|
|
typeof scriptOrCallback === 'function' |
|
|
|
parameters: [request, buildQueryOptions], |
|
|
|
? await scriptOrCallback(request, buildQueryOptions) |
|
|
|
notCallableReturn: sqlscript, |
|
|
|
: scriptOrCallback; |
|
|
|
}), |
|
|
|
|
|
|
|
); |
|
|
|
result = await query(sqlscript); |
|
|
|
} catch (queryError) { |
|
|
|
} catch (queryError) { |
|
|
|
stderr(`Failed to execute query; CAUSE: ${queryError}`); |
|
|
|
stderr(`Failed to execute query; CAUSE: ${queryError}`); |
|
|
|
|
|
|
|
|
|
|
|