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

Method main

storage/connect/Client.java:17–84  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

15 static JdbcInterface jdi = null;
16
17 public static void main(String[] args) {
18 int rc, n, ncol, i = 0, fsize = 0;
19 boolean scrollable = false;
20 String s;
21 String[] parms = new String[4];
22
23 if (args.length > 0)
24 try {
25 i = Integer.parseInt(args[i]);
26 } catch (NumberFormatException e) {
27 i = 0;
28 } // end try/catch
29
30 switch (i) {
31 case 1:
32 jdi = new ApacheInterface(DEBUG);
33 break;
34 case 2:
35 jdi = new MysqlInterface(DEBUG);
36 break;
37 case 3:
38 jdi = new MariadbInterface(DEBUG);
39 break;
40 case 4:
41 jdi = new OracleInterface(DEBUG);
42 break;
43 case 5:
44 jdi = new PostgresqlInterface(DEBUG);
45 break;
46 default:
47 jdi = new JdbcInterface(DEBUG);
48 } // endswitch i
49
50 parms[0] = getLine("Driver: ", false);
51 parms[1] = getLine("URL: ", false);
52 parms[2] = getLine("User: ", false);
53 parms[3] = getLine("Password: ", true);
54 s = getLine("Fsize: ", false);
55 fsize = (s != null) ? Integer.parseInt(s) : 0;
56 s = getLine("Scrollable: ", false);
57 scrollable = (s != null) ? s.toLowerCase().charAt(0) != 'n' : false;
58
59 rc = jdi.JdbcConnect(parms, fsize, scrollable);
60
61 if (rc == 0) {
62 String query;
63 System.out.println("Successfully connected to " + parms[1]);
64
65 s = jdi.GetQuoteString();
66 System.out.println("Qstr = '" + s + "'");
67
68 while ((query = getLine("Query: ", false)) != null) {
69 n = jdi.Execute(query);
70 System.out.println("Returned n = " + n);
71
72 if ((ncol = jdi.GetResult()) > 0)
73 PrintResult(ncol);
74 else

Callers

nothing calls this directly

Calls 8

getLineMethod · 0.95
PrintResultMethod · 0.95
GetQuoteStringMethod · 0.80
ExecuteMethod · 0.80
JdbcDisconnectMethod · 0.80
JdbcConnectMethod · 0.45
GetResultMethod · 0.45
GetErrmsgMethod · 0.45

Tested by

no test coverage detected