-
Notifications
You must be signed in to change notification settings - Fork 1
/
data.cpp
executable file
·70 lines (59 loc) · 1.84 KB
/
data.cpp
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
#include "database.h"
#include "utils.h"
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char ** argv) {
database data;
string path;
string url;
string user;
string password;
string database;
string u;
string p;
if (argc == 2) {
path = argv[1];
data.init(path);
} else if (argc == 6) {
path = argv[1];
url = argv[2];
user = argv[3];
password = argv[4];
database = argv[5];
data.init(path, url, user, password, database);
} else if (argc == 3) {
u = argv[1];
p = argv[2];
} else if (argc == 4) {
u = argv[1];
p = argv[2];
path = argv[3];
}
// } else {
// cout << "Invalid number of arguments." << endl;
// return 1;
// }
data.initDatabase();
// vector<pair<int, string> > ans = data.search("life", 10, 0);
// for (vector<pair<int, string> >::size_type i = 0; i < ans.size(); i++) {
// cout << ans[i].first << " " << ans[i].second << endl;
// }
//cout << data.changePassword(u,p,path);
// vector<string> ans = data.preciseFetch(430);
// for (vector<string>::size_type i = 0; i < ans.size(); i++) {
// cout << ans[i] << endl;
// }
//cout << data.fetchPic(1212) << endl;
// vector<pair<int, string> > ans = data.fetchLatest(10);
// for (vector<pair<int, string> >::size_type i = 0; i < ans.size(); i++) {
// cout << ans[i].first << " " << ans[i].second << endl;
// }
//vector<int> ans = data.hotTypeCollect("xin", 10, "TV");
// vector<int> ans = data.FavoriteCollect("xin", 10);
// for (vector<int>::size_type i = 0; i < ans.size(); i++) {
// cout << ans[i] << endl;
// }
//cout << data.addComment("xin", 123, "good", 1, 5) << endl;
return 0;
}