MCPcopy Create free account
hub / github.com/PostHog/duckgres / getCommandType

Method getCommandType

server/conn.go:2071–2140  ·  view source on GitHub ↗
(upperQuery string)

Source from the content-addressed store, hash-verified

2069 i++
2070 }
2071
2072 case '"':
2073 // Double-quoted identifier — skip to closing quote.
2074 i++
2075 for i < len(upper) {
2076 if upper[i] == '"' {
2077 i++
2078 if i < len(upper) && upper[i] == '"' {
2079 i++ // "" escape
2080 continue
2081 }
2082 break
2083 }
2084 i++
2085 }
2086
2087 case '$':
2088 // Dollar-quoted string: $tag$...$tag$ or $$...$$
2089 if tag, ok := parseDollarTag(upper, i); ok {
2090 i += len(tag) // skip opening tag
2091 for i+len(tag) <= len(upper) {
2092 if upper[i] == '$' && upper[i:i+len(tag)] == tag {
2093 i += len(tag) // skip closing tag
2094 break
2095 }
2096 i++
2097 }
2098 } else {
2099 i++
2100 }
2101
2102 case '-':
2103 // Line comment: -- ... \n
2104 if i+1 < len(upper) && upper[i+1] == '-' {
2105 i += 2
2106 for i < len(upper) && upper[i] != '\n' {
2107 i++
2108 }
2109 } else {
2110 i++
2111 }
2112
2113 case '/':
2114 // Block comment: /* ... */
2115 if i+1 < len(upper) && upper[i+1] == '*' {
2116 i += 2
2117 for i+1 < len(upper) {
2118 if upper[i] == '*' && upper[i+1] == '/' {
2119 i += 2
2120 break
2121 }
2122 i++
2123 }
2124 } else {
2125 i++
2126 }
2127
2128 case 'R':

Callers 12

handleExecuteMethod · 0.95
TestGetCommandTypeFunction · 0.95
TestETLCommentedQueriesFunction · 0.95
TestETLBatchOperationsFunction · 0.95
TestETLSchemaEvolutionFunction · 0.95
execUserSecretDDLMethod · 0.95
handleQueryMethod · 0.95
executeMultiStatementMethod · 0.95

Calls 3

stripLeadingCommentsFunction · 0.85
isWSCharFunction · 0.85
outerStatementOfCTEFunction · 0.85

Tested by 6

TestGetCommandTypeFunction · 0.76
TestETLCommentedQueriesFunction · 0.76
TestETLBatchOperationsFunction · 0.76
TestETLSchemaEvolutionFunction · 0.76