Generates a database name from the name of this resource. The path will be chopped and special characters from the remaining name will be removed. @return database name
()
| 274 | * @return database name |
| 275 | */ |
| 276 | public final String dbName() { |
| 277 | final TokenBuilder tb = new TokenBuilder(); |
| 278 | final byte[] token = token(name()); |
| 279 | int nl = lastIndexOf(token, '.'); |
| 280 | if(nl == -1) nl = token.length; |
| 281 | for(int n = 0; n < nl; n += cl(token, n)) { |
| 282 | final int ch = noDiacritics(cp(token, n)); |
| 283 | if(Databases.validChar(ch, n == 0 || n + 1 == nl)) tb.add(ch); |
| 284 | } |
| 285 | // return hash code if string is empty (mainly required for CHECK command) |
| 286 | return tb.isEmpty() ? Integer.toString(hashCode()) : tb.toString(); |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * Returns the name of the resource. |