-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyelp.hpp
178 lines (152 loc) · 3.21 KB
/
yelp.hpp
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#include <memory>
#include <odb/core.hxx>
#include <odb/lazy-ptr.hxx>
#include <set>
#include <string>
#pragma db view
class StarCount{
public:
int stars;
int count;
};
#pragma db view query("select top 1 text, last_elapsed_time from sys.dm_exec_query_stats cross apply sys.dm_exec_sql_text(sql_handle) order by last_execution_time desc")
class LastQueryTime{
public:
std::string text;
long elapsed_time;
};
// ---------------------------------------------
// No need to change anything above this line
// ---------------------------------------------
// out of scope declarations predeclared here.
class hour;
class category;
class business;
class review;
class user;
class photo;
# pragma db object no_id
class attribute {
public:
std::string name;
std::string value;
odb::lazy_ptr<business> business_id;
};
# pragma db object
class business {
public:
# pragma db id
std::string id;
std::string name;
std::string neighborhood;
std::string address;
std::string city;
std::string state;
std::string postal_code;
float latitude;
float longitude;
float stars;
int review_count;
short int is_open;
# pragma db inverse(business_id)
std::vector<std::shared_ptr<hour>> business_hours;
# pragma db inverse(business_id)
std::vector<std::shared_ptr<review>> business_reviews;
# pragma db inverse(business_id)
std::vector<std::shared_ptr<photo>> business_photos;
};
# pragma db object no_id
class category {
public:
std::string category;
odb::lazy_ptr<business> business_id;
};
# pragma db object no_id
class checkin {
public:
std::string date;
int count;
odb::lazy_ptr<business> business_id;
};
# pragma db object no_id
class elite_years {
public:
int year;
odb::lazy_ptr<user> user_id;
};
# pragma db object table("friend") // because 'friend' is a reserved C++ keyword.
class friends {
public:
# pragma db id
std::string friend_id;
odb::lazy_ptr<user> user_id;
};
#pragma db object table("hours") // because overlaps with the attribute name.
class hour {
public:
# pragma db id
int id;
std::string hours;
odb::lazy_ptr<business> business_id;
};
# pragma db object
class photo {
public:
# pragma db id
std::string id;
std::string caption;
std::string label;
odb::lazy_ptr<business> business_id;
};
# pragma db object
class review {
public:
# pragma db id
std::string id;
int stars;
std::string date;
std::string text;
int useful;
int funny;
int cool;
odb::lazy_ptr<business> business_id;
odb::lazy_ptr<user> user_id;
};
# pragma db object no_id
class tip {
public:
std::string text;
std::string date;
int likes;
odb::lazy_ptr<business> business_id;
odb::lazy_ptr<user> user_id;
};
# pragma db object
class user {
public:
# pragma db id
std::string id;
std::string name;
int review_count;
std::string yelping_since;
int useful;
int funny;
int cool;
int fans;
float average_stars;
int compliment_hot;
int compliment_more;
int compliment_profile;
int compliment_cute;
int compliment_list;
int compliment_note;
int compliment_plain;
int compliment_cool;
int compliment_funny;
int compliment_writer;
int compliment_photos;
# pragma db inverse(user_id)
std::vector<std::shared_ptr<review>> user_reviews;
# pragma db inverse(user_id)
std::vector<std::shared_ptr<friends>> user_friends;
};