This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
71 lines (65 loc) · 2.56 KB
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import com.beust.jcommander.JCommander;
import driver.DriverConnector;
import repository.DatabaseRepository;
import services.AdmissionYearListService;
import services.SheetReadingService;
import util.YamlReadingUtil;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
YamlReadingUtil util = new YamlReadingUtil();
JCommander cmdArgs = JCommander
.newBuilder()
.addObject(util)
.build();
cmdArgs.parse(args);
System.out.println("Enter quit to stop program");
String quit = "";
while (!quit.equals("q")) {
DriverConnector connector = new DriverConnector(util.read());
DatabaseRepository repo = new DatabaseRepository(connector);
AdmissionYearListService yearListService = new AdmissionYearListService();
Scanner sc = new Scanner(System.in);
System.out.println("Enter sheetID");
String sheetId = sc.nextLine();
System.out.println("Enter Range");
String range = sc.nextLine();
SheetReadingService readingService = new SheetReadingService(repo,yearListService);
readingService.sortAndBatch();
/* working for user table name
query is Create table users(id int,name varchar(20),email varchar(30),gender char(2),sport varchar(20));
*/
System.out.println("to make table enter 1");
int table = sc.nextInt();
if (table == 1) {
if (!repo.createTable()) {
System.out.println("Not created");
} else {
System.out.println("Created Table");
}
}
System.out.println("Enter 1 to run custom select queries");
int choice = sc.nextInt();
if (choice == 1) {
sc.nextLine();
boolean bool = true;
while (bool) {
System.out.println("Enter your select query");
String sql = sc.nextLine();
repo.queryPrinter(sql);
System.out.println("enter 1 to run different query");
int run = sc.nextInt();
if (run == 1) {
bool = true;
sc.nextLine();
}else{
bool = false;
}
}
}
sc.nextLine();
System.out.println("to quit enter q");
quit = sc.nextLine();
}
}
}