MCPcopy Create free account
hub / github.com/bytebase/bytebase / addLimitFor11g

Function addLimitFor11g

backend/plugin/db/oracle/query.go:194–199  ·  view source on GitHub ↗

addLimitFor11g adds a ROWNUM-based limit for Oracle 11g and earlier versions. Uses the legacy approach with subquery and ROWNUM.

(statement string, limitCount int)

Source from the content-addressed store, hash-verified

192// addLimitFor11g adds a ROWNUM-based limit for Oracle 11g and earlier versions.
193// Uses the legacy approach with subquery and ROWNUM.
194func addLimitFor11g(statement string, limitCount int) string {
195 if !isSelectOrWithStatement(statement) {
196 return statement
197 }
198 return fmt.Sprintf("SELECT * FROM (%s) WHERE ROWNUM <= %d", util.TrimStatement(statement), limitCount)
199}
200
201// isSelectOrWithStatement checks if the statement is a SELECT or WITH statement
202func isSelectOrWithStatement(statement string) bool {

Callers 2

addResultLimitFunction · 0.85
addLimitFor12cAndLaterFunction · 0.85

Calls 2

TrimStatementFunction · 0.92
isSelectOrWithStatementFunction · 0.85

Tested by

no test coverage detected