Remembers a parsed database option. @param name name of option @param value value of option @param parser query parser @throws QueryException query exception
(final String name, final String value, final QueryParser parser)
| 41 | * @throws QueryException query exception |
| 42 | */ |
| 43 | void add(final String name, final String value, final QueryParser parser) throws QueryException { |
| 44 | final String key = name.toUpperCase(Locale.ENGLISH); |
| 45 | final MainOptions options = qc.context.options; |
| 46 | final Option<?> option = options.option(key); |
| 47 | if(option == null) throw BASEX_OPTIONSINV_X.get(parser.info(), options.similar(name)); |
| 48 | |
| 49 | // try to assign option to dummy options |
| 50 | if(dummyOptions == null) dummyOptions = new MainOptions(false); |
| 51 | try { |
| 52 | dummyOptions.assign(key, value); |
| 53 | } catch(final BaseXException ex) { |
| 54 | Util.debug(ex); |
| 55 | throw BASEX_OPTIONS_X_X.get(parser.info(), key, value); |
| 56 | } |
| 57 | // if successful, cache assigned value |
| 58 | localOpts.put(option, dummyOptions.get(option)); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Compiles all options. |