MCPcopy Create free account
hub / github.com/BaseXdb/basex / insert

Method insert

basex-core/src/main/java/org/basex/query/QueryParser.java:4255–4284  ·  view source on GitHub ↗

Parses the "InsertExpr" rule. @return query expression or null @throws QueryException query exception

()

Source from the content-addressed store, hash-verified

4253 * @throws QueryException query exception
4254 */
4255 private Expr insert() throws QueryException {
4256 final int p = pos;
4257 if(!wsConsumeWs(INSERT) || !wsConsumeWs(NODE) && !wsConsumeWs(NODES)) {
4258 pos = p;
4259 return null;
4260 }
4261
4262 final Expr s = check(single(), INCOMPLETE);
4263 Mode mode = Mode.INTO;
4264 if(wsConsumeWs(AS)) {
4265 if(wsConsumeWs(FIRST)) {
4266 mode = Mode.FIRST;
4267 } else {
4268 wsCheck(LAST);
4269 mode = Mode.LAST;
4270 }
4271 wsCheck(INTO);
4272 } else if(!wsConsumeWs(INTO)) {
4273 if(wsConsumeWs(AFTER)) {
4274 mode = Mode.AFTER;
4275 } else if(wsConsumeWs(BEFORE)) {
4276 mode = Mode.BEFORE;
4277 } else {
4278 throw error(INCOMPLETE);
4279 }
4280 }
4281 final Expr trg = check(single(), INCOMPLETE);
4282 qc.updating();
4283 return new Insert(info(), s, mode, trg);
4284 }
4285
4286 /**
4287 * Parses the "DeleteExpr" rule.

Callers 1

singleMethod · 0.95

Calls 7

wsConsumeWsMethod · 0.95
checkMethod · 0.95
singleMethod · 0.95
wsCheckMethod · 0.95
errorMethod · 0.95
infoMethod · 0.95
updatingMethod · 0.45

Tested by

no test coverage detected