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

Method main

storage/connect/Client3.java:14–101  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

12 static Mongo3Interface jdi = null;
13
14 public static void main(String[] args) {
15 int rc, level = 0;
16 boolean brc, desc = false;
17 Set<String> columns;
18 String[] parms = new String[4];
19
20 jdi = new Mongo3Interface(DEBUG);
21
22 parms[0] = getLine("URI: ", false);
23 parms[1] = getLine("Database: ", false);
24 parms[2] = null;
25 parms[3] = null;
26
27 if (parms[0] == null)
28 parms[0] = "mongodb://localhost:27017";
29
30 if (parms[1] == null)
31 parms[1] = "test";
32
33 rc = jdi.MongoConnect(parms);
34
35 if (rc == 0) {
36 String name, pipeline, query, fields;
37 System.out.println("Successfully connected to " + parms[0]);
38
39 while ((name = getLine("Collection: ", false)) != null) {
40 if (jdi.GetCollection(name))
41 System.out.println("GetCollection failed");
42 else
43 System.out.println("Collection size: " + jdi.GetCollSize());
44
45 pipeline = getLine("Pipeline: ", false);
46
47 if (pipeline == null || (desc = pipeline.equals("*"))) {
48 query = getLine("Filter: ", false);
49 fields = getLine("Proj: ", false);
50
51 if (desc)
52 level = Integer.parseInt(getLine("Level: ", false));
53
54 brc = jdi.FindColl(query, fields);
55 } else
56 brc = jdi.AggregateColl(pipeline);
57
58 System.out.println("Returned brc = " + brc);
59
60 if (!brc && !desc) {
61 for (int i = 0; jdi.ReadNext() > 0 && i < 10; i++) {
62 columns = jdi.GetColumns();
63
64 for (String col : columns)
65 System.out.println(col + "=" + jdi.GetField(col));
66
67 if (name.equalsIgnoreCase("gtst"))
68 System.out.println("gtst=" + jdi.GetField("*"));
69
70 if (name.equalsIgnoreCase("inventory")) {
71 System.out.println("warehouse=" + jdi.GetField("instock.0.warehouse"));

Callers

nothing calls this directly

Calls 13

getLineMethod · 0.95
discoveryMethod · 0.95
MongoConnectMethod · 0.45
GetCollectionMethod · 0.45
GetCollSizeMethod · 0.45
equalsMethod · 0.45
FindCollMethod · 0.45
AggregateCollMethod · 0.45
ReadNextMethod · 0.45
GetColumnsMethod · 0.45
GetFieldMethod · 0.45
MongoDisconnectMethod · 0.45

Tested by

no test coverage detected