dbName uses the current database from the context if a database is not specified, otherwise it returns the given database name.
(ctx *sql.Context, dbName string)
| 286 | // dbName uses the current database from the context if a database is not specified, otherwise it returns the given |
| 287 | // database name. |
| 288 | func (h *AuthorizationHandler) dbName(ctx *sql.Context, dbName string) string { |
| 289 | if len(dbName) == 0 { |
| 290 | dbName = ctx.GetCurrentDatabase() |
| 291 | } |
| 292 | // Revision databases take the form "dbname/revision", so we must split the revision from the database name |
| 293 | splitDbName := strings.SplitN(dbName, "/", 2) |
| 294 | return splitDbName[0] |
| 295 | } |
| 296 | |
| 297 | // checkPrivilegeOnSchema checks privileges for given schema. |
| 298 | func checkPrivilegeOnSchema(state AuthorizationQueryState, schemaName string, privileges []Privilege) error { |