MCPcopy Create free account
hub / github.com/MariaDB/server / GetField

Method GetField

storage/connect/Mongo3Interface.java:437–474  ·  view source on GitHub ↗
(String path)

Source from the content-addressed store, hash-verified

435 } // end of GetFieldObject
436
437 public String GetField(String path) {
438 BsonValue o = GetFieldObject(path);
439
440 if (o != null) {
441 if (o.isString()) {
442 return o.asString().getValue();
443 } else if (o.isInt32()) {
444 return Integer.toString(o.asInt32().getValue());
445 } else if (o.isInt64()) {
446 return Long.toString(o.asInt64().getValue());
447 } else if (o.isObjectId()) {
448 return o.asObjectId().getValue().toString();
449 } else if (o.isDateTime()) {
450 Integer TS = (int) (o.asDateTime().getValue() / 1000);
451 return TS.toString();
452 } else if (o.isDouble()) {
453 return Double.toString(o.asDouble().getValue());
454 } else if (o.isBoolean()) {
455 return o.asBoolean().getValue() ? "1" : "0";
456 } else if (o.isDocument()) {
457 return o.asDocument().toJson();
458 } else if (o.isArray()) {
459 util = new BsonDocument("arr", o.asArray());
460 String s = util.toJson();
461 int i1 = s.indexOf('[');
462 int i2 = s.lastIndexOf(']');
463 return s.substring(i1, i2 + 1);
464 } else if (o.isDecimal128()) {
465 return o.asDecimal128().toString();
466 } else if (o.isNull()) {
467 return null;
468 } else
469 return o.toString();
470
471 } else
472 return null;
473
474 } // end of GetField
475
476 public Object MakeBson(String s, int json) {
477 BsonValue bval;

Callers

nothing calls this directly

Calls 1

GetFieldObjectMethod · 0.95

Tested by

no test coverage detected