This repository has been archived by the owner on May 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cassandra Commands.txt
121 lines (67 loc) · 3.74 KB
/
Cassandra Commands.txt
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
CREATE KEYSPACE smsdb
WITH replication = {'class':'SimpleStrategy', 'replication_factor' : 3};
String query =" INSERT INTO user (id,username,firstname,lastname,email,address,password,phone,roleid) VALUES("+uniqueID+",'sanjayaganani92','sanjay','Agnani', '[email protected]','Ahmedabad','1223',9601486744,2)”;
INSERT INTO user (id,username,firstname,lastname,email,address,password,phone,roleid) VALUES(2,’teacher’,’teacher’,’teacher', '[email protected]','Ahmedabad’,’teacher’,9601486744,1);
ALTER TABLE users ADD coupon_code varchar;
ALTER TABLE cycling.cyclist_alt_stats ADD favorite_color varchar;
ALTER TABLE cycling.cyclist_alt_stats ALTER favorite_color TYPE text;
UPDATE t1 SET col1 = col1 + 1, col2 = col1;
CQLSH : Unable to Login
InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING"
cqlsh:smsdb> select * from user where username ='sam' ALLOW FILTERING;
for (Row row : result) {
System.out.format("%s %d %sn", row.getString("firstname"),
row.getInt("id"), row.getString("address"));
System.out.println("");
}
@RequestMapping(value = "/loginProcess", method = RequestMethod.POST)
public ModelAndView loginprocess(HttpServletRequest request, HttpServletResponse response, Model model,
@ModelAttribute("login") Login login) {
System.out.println("Username:" + login.getUsername());
String s = "sanjay";
System.out.println(s.compareTo(login.getUsername()));
String query = "select * from user where username ='"+login.getUsername()+"' ALLOW FILTERING; ";
session.execute(query);
ResultSet result = session.execute(query);
for (Row row : result) {
System.out.format("%s %d %sn", row.getString("firstname"),
row.getInt("id"), row.getString("address"));
System.out.println("");
}
System.out.println(result.all());
System.out.println(result.all().toString());
System.out.println(Row.class);
System.out.println(Row.class);
System.out.println(result.getColumnDefinitions());
if (s.compareTo(login.getUsername()) == 0) {
model.addAttribute("message", login.getUsername() + " Logged in Successfully");
List<User> list=new ArrayList<User>();
list.add(new User("s","rahul","S.Engineer"));
list.add(new User("sd","aditya","IT Manager"));
list.add(new User("ssa","sachin","Care Taker"));
return new ModelAndView("s","list",list);
//return "s";
}
else {
model.addAttribute("message", "Please check entered username and password");
System.out.println(response.getStatus());
//return "login";
String list ="s";
return new ModelAndView("login","list",list);
}
}
==============
//System.out.println("Query Resultset for particaular user"+login.getUsername()+","+querystudentresult.all());
//List<Student> list1 = new ArrayList<Student>();
//list1.add(new Student("Maths",89,"SS",90,"Sasads"));
//Row roww = querystudentresult.one();
//list1.add(new Student(roww.getString("sub_mathss").toString(),roww.getInt("sub_maths_marks"),roww.getString("sub_ss").toString(),roww.getInt("sub_ss_marks"),roww.getString("username")));
// for (Row roww : querystudentresult.all()) {
//
// System.out.println("MATHSSSSSS"+roww.getString("sub_maths"));
// list1.add(new Student(roww.getString("sub_mathss").toString(),roww.getInt("sub_maths_marks"),roww.getString("sub_ss").toString(),roww.getInt("sub_ss_marks"),roww.getString("username")));
//
// // list1.add(new Student("Maths",89,"SS",90,"Sasads"));
//
//
// }