fix: final polish — teardown, image pin, license
This commit is contained in:
+19
-1
@@ -141,11 +141,29 @@ const skipBlockComment = (sql: string, start: number, engine: Engine): number =>
|
||||
return i
|
||||
}
|
||||
|
||||
// True when the single quote at `start` opens a postgres E'...' / e'...'
|
||||
// escape-string literal: the immediately preceding char is a standalone E/e
|
||||
// prefix (the char before it must be a non-identifier char or the string start,
|
||||
// so that the E is not the tail of a longer identifier).
|
||||
const isPostgresEscapeString = (sql: string, start: number, engine: Engine): boolean => {
|
||||
if (engine !== 'postgres' || start === 0) {
|
||||
return false
|
||||
}
|
||||
const prev = sql[start - 1]
|
||||
if (prev !== 'E' && prev !== 'e') {
|
||||
return false
|
||||
}
|
||||
return start - 1 === 0 || !isWordChar(sql[start - 2])
|
||||
}
|
||||
|
||||
const skipSingleQuoted = (sql: string, start: number, engine: Engine): number => {
|
||||
// mysql strings honor backslash escapes; postgres only does so for the
|
||||
// E'...' escape-string syntax, where '\'' does not terminate the string.
|
||||
const backslashEscapes = engine === 'mysql' || isPostgresEscapeString(sql, start, engine)
|
||||
let i = start + 1
|
||||
while (i < sql.length) {
|
||||
const ch = sql[i]
|
||||
if (engine === 'mysql' && ch === '\\') {
|
||||
if (backslashEscapes && ch === '\\') {
|
||||
i += 2
|
||||
continue
|
||||
}
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ export const registerSchemaTools = (server: McpServer, manager: Manager): void =
|
||||
'list_databases',
|
||||
{
|
||||
description:
|
||||
'List databases on a connection with their size in bytes (system databases hidden).',
|
||||
'List databases on a connection with size in bytes. Hides postgres template databases and mysql system schemas.',
|
||||
inputSchema: {
|
||||
connection: z.string().describe('connection name, see list_connections')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user