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

Method main

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

Source from the content-addressed store, hash-verified

12 static Mongo2Interface jdi = null;
13
14 public static void main(String[] args) {
15 int rc, m, i = 0;
16 boolean brc;
17 Set<String> columns;
18 String[] parms = new String[4];
19
20 jdi = new Mongo2Interface(DEBUG);
21
22 parms[0] = getLine("URI: ", false);
23 parms[1] = getLine("DB: ", 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[1]);
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) {
48 query = getLine("Filter: ", false);
49 fields = getLine("Proj: ", false);
50 brc = jdi.FindColl(query, fields);
51 } else
52 brc = jdi.AggregateColl(pipeline);
53
54 System.out.println("Returned brc = " + brc);
55
56 if (!brc) {
57 for (i = 0; i < 10; i++) {
58 m = jdi.ReadNext();
59
60 if (m > 0) {
61 columns = jdi.GetColumns();
62
63 for (String col : columns)
64 System.out.println(col + "=" + jdi.GetField(col));
65
66 if (pipeline == null) {
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 11

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

Tested by

no test coverage detected