GetCurrentSchema returns the current schema used by the context. Defaults to "public" if the context does not specify a schema.
(ctx *sql.Context)
| 22 | // GetCurrentSchema returns the current schema used by the context. Defaults to "public" if the context does not specify |
| 23 | // a schema. |
| 24 | func GetCurrentSchema(ctx *sql.Context) (string, error) { |
| 25 | _, root, err := GetRootFromContext(ctx) |
| 26 | if err != nil { |
| 27 | return "", nil |
| 28 | } |
| 29 | |
| 30 | return resolve.FirstExistingSchemaOnSearchPath(ctx, root) |
| 31 | } |
| 32 | |
| 33 | // GetSchemaName returns the schema name if there is any exist. |
| 34 | // If the given schema is not empty, it's returned. |
no test coverage detected