MCPcopy Create free account
hub / github.com/jOOQ/jOOQ / startElement

Method startElement

jOOQ/src/main/java/org/jooq/impl/XMLHandler.java:391–486  ·  view source on GitHub ↗
(String uri, String localName, String qName, Attributes attributes)

Source from the content-addressed store, hash-verified

389 }
390
391 @SuppressWarnings({ "unchecked" })
392 @Override
393 public final void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
394 if (debug)
395 if (log.isDebugEnabled())
396 log.debug("> " + qName);
397
398 if (s.writer != null) {
399 s.writer.startElement(uri, localName, qName, attributes);
400 }
401 else if (!s.inResult && "result".equalsIgnoreCase(qName)) {
402 s.inResult = true;
403 }
404 else if (s.inColumn && "result".equalsIgnoreCase(qName)) {
405 Field<?> f = s.row.field(s.column);
406
407 if (isMultisetOrArrayOfRecords(f)) {
408 states.push(s);
409 s = new State<>(ctx, (AbstractRow<R>) f.getDataType().getRow(), (Class<R>) f.getDataType().getRecordType());
410 s.inResult = true;
411 }
412 else
413 throw new UnsupportedOperationException("Nested result sets not supported yet");
414 }
415 else if (s.inResult && "fields".equalsIgnoreCase(qName)) {
416 s.inFields = true;
417 }
418 else if (s.inResult && s.inFields && "field".equalsIgnoreCase(qName)) {
419 String catalog = attributes.getValue("catalog");
420 String schema = attributes.getValue("schema");
421 String table = attributes.getValue("table");
422 String name = attributes.getValue("name");
423 String type = attributes.getValue("type");
424
425 // [#13426] Don't use the dialect specific data type, because that isn't what's being exported, either.
426 s.fields.add(field(name(catalog, schema, table, name), getDataType(null, defaultIfBlank(type, "VARCHAR"))));
427 }
428 else if (s.inResult && "records".equalsIgnoreCase(qName)) {}
429 else if (s.inResult && "record".equalsIgnoreCase(qName)) {
430 s.inRecord++;
431 s.nilRecord = isNil(attributes);
432
433 if (s.inColumn) {
434 Field<?> f = s.row.field(s.column);
435
436 if (f.getDataType().isRecord()) {
437 states.push(s);
438 s = new State<>(ctx, (AbstractRow<R>) f.getDataType().getRow(), (Class<R>) f.getDataType().getRecordType());
439 s.inResult = true;
440 }
441 else
442 throw new UnsupportedOperationException("Nested records not supported yet");
443 }
444 }
445 else if (s.inColumn && "element".equalsIgnoreCase(qName) && s.elements != null) {
446 s.inElement = true;
447 }
448 else {

Callers 1

intoXMLMethod · 0.45

Calls 15

isNilMethod · 0.95
isArrayOfRecordsMethod · 0.95
defaultIfBlankMethod · 0.80
isDebugEnabledMethod · 0.65
debugMethod · 0.65
equalsIgnoreCaseMethod · 0.65
fieldMethod · 0.65
getRowMethod · 0.65
getDataTypeMethod · 0.65
getRecordTypeMethod · 0.65
getValueMethod · 0.65

Tested by

no test coverage detected