| 32 | |
| 33 | |
| 34 | bool Sql_path::try_resolve_in_schema(THD *thd, const Lex_ident_db_normalized &schema, |
| 35 | sp_name *name, const Sp_handler **sph, |
| 36 | Database_qualified_name *pkgname, |
| 37 | bool *resolved) const |
| 38 | { |
| 39 | DBUG_ASSERT(resolved); |
| 40 | int ret; |
| 41 | |
| 42 | if (check_db_dir_existence(schema.str)) |
| 43 | return false; // Schema doesn't exist |
| 44 | |
| 45 | Database_qualified_name tmp_spname; |
| 46 | tmp_spname.m_name= name->m_name; |
| 47 | |
| 48 | if (!name->m_explicit_name) |
| 49 | { |
| 50 | // Try to find routine directly in schema |
| 51 | tmp_spname.m_db= schema; |
| 52 | if (!(ret= (*sph)->sp_routine_exists(thd, &tmp_spname))) |
| 53 | { |
| 54 | /* |
| 55 | [schema] '.' routine_name |
| 56 | */ |
| 57 | name->m_db= Lex_ident_db_normalized(thd->strmake(schema.str, schema.length), |
| 58 | schema.length); |
| 59 | *resolved= true; |
| 60 | return false; |
| 61 | } |
| 62 | else if (ret != SP_KEY_NOT_FOUND) |
| 63 | return true; |
| 64 | } |
| 65 | else |
| 66 | { |
| 67 | // Try package routine resolution |
| 68 | if (is_package_public_routine(thd, schema, name->m_db, name->m_name, (*sph)->type())) |
| 69 | { |
| 70 | /* |
| 71 | [schema] '.' pkg_name '.' routine_name routine |
| 72 | */ |
| 73 | pkgname->m_db= schema; |
| 74 | pkgname->m_name= Lex_ident_routine(name->m_db); |
| 75 | *sph= (*sph)->package_routine_handler(); |
| 76 | *resolved= true; |
| 77 | return name->make_package_routine_name(thd->mem_root, schema, |
| 78 | name->m_db, name->m_name); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | |
| 86 | bool Sql_path::resolve(THD *thd, sp_head *caller, sp_name *name, |
nothing calls this directly
no test coverage detected