Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
database.cpp
Go to the documentation of this file.
3
4namespace sysio { namespace chain { namespace webassembly {
9 return context.db_store_i64( name(scope), name(table), account_name(payer), id, buffer.data(), buffer.size() );
10 }
12 context.db_update_i64( itr, account_name(payer), buffer.data(), buffer.size() );
13 }
15 context.db_remove_i64( itr );
16 }
18 return context.db_get_i64( itr, buffer.data(), buffer.size() );
19 }
21 return context.db_next_i64(itr, *primary);
22 }
24 return context.db_previous_i64(itr, *primary);
25 }
27 return context.db_find_i64( name(code), name(scope), name(table), id );
28 }
30 return context.db_lowerbound_i64( name(code), name(scope), name(table), id );
31 }
33 return context.db_upperbound_i64( name(code), name(scope), name(table), id );
34 }
36 return context.db_end_i64( name(code), name(scope), name(table) );
37 }
38
43 return context.idx64.store( scope, table, account_name(payer), id, *secondary );
44 }
46 context.idx64.update( iterator, account_name(payer), *secondary );
47 }
49 context.idx64.remove( iterator );
50 }
52 return context.idx64.find_secondary(code, scope, table, *secondary, *primary);
53 }
55 return context.idx64.find_primary(code, scope, table, *secondary, primary);
56 }
58 const int32_t ret = context.idx64.lowerbound_secondary(code, scope, table, *secondary, *primary);
59 (void)legacy_ptr<uint64_t>(std::move(secondary));
60 (void)legacy_ptr<uint64_t>(std::move(primary));
61 return ret;
62 }
64 const int32_t ret = context.idx64.upperbound_secondary(code, scope, table, *secondary, *primary);
65 (void)legacy_ptr<uint64_t>(std::move(secondary));
66 (void)legacy_ptr<uint64_t>(std::move(primary));
67 return ret;
68 }
70 return context.idx64.end_secondary(code, scope, table);
71 }
73 return context.idx64.next_secondary(iterator, *primary);
74 }
76 return context.idx64.previous_secondary(iterator, *primary);
77 }
78
79
84 return context.idx128.store( scope, table, account_name(payer), id, *secondary );
85 }
87 return context.idx128.update( iterator, account_name(payer), *secondary );
88 }
90 return context.idx128.remove( iterator );
91 }
93 return context.idx128.find_secondary(code, scope, table, *secondary, *primary);
94 }
96 return context.idx128.find_primary(code, scope, table, *secondary, primary);
97 }
99 int32_t result = context.idx128.lowerbound_secondary(code, scope, table, *secondary, *primary);
100 (void)legacy_ptr<uint128_t>(std::move(secondary));
101 (void)legacy_ptr<uint64_t>(std::move(primary));
102 return result;
103 }
105 int32_t result = context.idx128.upperbound_secondary(code, scope, table, *secondary, *primary);
106 (void)legacy_ptr<uint128_t>(std::move(secondary));
107 (void)legacy_ptr<uint64_t>(std::move(primary));
108 return result;
109 }
111 return context.idx128.end_secondary(code, scope, table);
112 }
114 return context.idx128.next_secondary(iterator, *primary);
115 }
117 return context.idx128.previous_secondary(iterator, *primary);
118 }
119
123 inline static constexpr uint32_t idx256_array_size = 2;
125 SYS_ASSERT( data.size() == idx256_array_size,
126 db_api_exception,
127 "invalid size of secondary key array for idx256: given ${given} bytes but expected ${expected} bytes",
128 ("given",data.size())("expected", idx256_array_size) );
129 return context.idx256.store(scope, table, account_name(payer), id, data.data());
130 }
132 SYS_ASSERT( data.size() == idx256_array_size,
133 db_api_exception,
134 "invalid size of secondary key array for idx256: given ${given} bytes but expected ${expected} bytes",
135 ("given",data.size())("expected", idx256_array_size) );
136 return context.idx256.update(iterator, account_name(payer), data.data());
137 }
139 return context.idx256.remove(iterator);
140 }
142 SYS_ASSERT( data.size() == idx256_array_size,
143 db_api_exception,
144 "invalid size of secondary key array for idx256: given ${given} bytes but expected ${expected} bytes",
145 ("given",data.size())("expected", idx256_array_size) );
146 return context.idx256.find_secondary(code, scope, table, data.data(), *primary);
147 }
149 SYS_ASSERT( data.size() == idx256_array_size,
150 db_api_exception,
151 "invalid size of secondary key array for idx256: given ${given} bytes but expected ${expected} bytes",
152 ("given",data.size())("expected", idx256_array_size) );
153 return context.idx256.find_primary(code, scope, table, data.data(), primary);
154 }
156 SYS_ASSERT( data.size() == idx256_array_size,
157 db_api_exception,
158 "invalid size of secondary key array for idx256: given ${given} bytes but expected ${expected} bytes",
159 ("given",data.size())("expected", idx256_array_size) );
160 int32_t result = context.idx256.lowerbound_secondary(code, scope, table, data.data(), *primary);
161 (void)legacy_span<uint128_t>(std::move(data));
162 (void)legacy_ptr<uint64_t>(std::move(primary));
163 return result;
164 }
166 SYS_ASSERT( data.size() == idx256_array_size,
167 db_api_exception,
168 "invalid size of secondary key array for idx256: given ${given} bytes but expected ${expected} bytes",
169 ("given",data.size())("expected", idx256_array_size) );
170 int32_t result = context.idx256.upperbound_secondary(code, scope, table, data.data(), *primary);
171 (void)legacy_span<uint128_t>(std::move(data));
172 (void)legacy_ptr<uint64_t>(std::move(primary));
173 return result;
174 }
176 return context.idx256.end_secondary(code, scope, table);
177 }
179 return context.idx256.next_secondary(iterator, *primary);
180 }
182 return context.idx256.previous_secondary(iterator, *primary);
183 }
184
189 return context.idx_double.store( scope, table, account_name(payer), id, *secondary );
190 }
192 return context.idx_double.update( iterator, account_name(payer), *secondary );
193 }
195 return context.idx_double.remove( iterator );
196 }
198 return context.idx_double.find_secondary(code, scope, table, *secondary, *primary);
199 }
201 return context.idx_double.find_primary(code, scope, table, *secondary, primary);
202 }
204 int32_t result = context.idx_double.lowerbound_secondary(code, scope, table, *secondary, *primary);
205 (void)legacy_ptr<float64_t>(std::move(secondary));
206 (void)legacy_ptr<uint64_t>(std::move(primary));
207 return result;
208 }
210 int32_t result = context.idx_double.upperbound_secondary(code, scope, table, *secondary, *primary);
211 (void)legacy_ptr<float64_t>(std::move(secondary));
212 (void)legacy_ptr<uint64_t>(std::move(primary));
213 return result;
214 }
216 return context.idx_double.end_secondary(code, scope, table);
217 }
219 return context.idx_double.next_secondary(iterator, *primary);
220 }
222 return context.idx_double.previous_secondary(iterator, *primary);
223 }
224
229 return context.idx_long_double.store( scope, table, account_name(payer), id, *secondary );
230 }
232 return context.idx_long_double.update( iterator, account_name(payer), *secondary );
233 }
235 return context.idx_long_double.remove( iterator );
236 }
238 return context.idx_long_double.find_secondary(code, scope, table, *secondary, *primary);
239 }
241 return context.idx_long_double.find_primary(code, scope, table, *secondary, primary);
242 }
244 int32_t result = context.idx_long_double.lowerbound_secondary(code, scope, table, *secondary, *primary);
245 (void)legacy_ptr<float128_t>(std::move(secondary));
246 (void)legacy_ptr<uint64_t>(std::move(primary));
247 return result;
248 }
250 int32_t result = context.idx_long_double.upperbound_secondary(code, scope, table, *secondary, *primary);
251 (void)legacy_ptr<float128_t>(std::move(secondary));
252 (void)legacy_ptr<uint64_t>(std::move(primary));
253 return result;
254 }
256 return context.idx_long_double.end_secondary(code, scope, table);
257 }
259 return context.idx_long_double.next_secondary(iterator, *primary);
260 }
262 return context.idx_long_double.previous_secondary(iterator, *primary);
263 }
264}}} // ns sysio::chain::webassembly
std::string name
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition exceptions.hpp:7
int32_t db_idx_long_double_lowerbound(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< float128_t, 8 > secondary, legacy_ptr< uint64_t, 8 > primary)
Definition database.cpp:243
int32_t db_idx64_lowerbound(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< uint64_t, 8 > secondary, legacy_ptr< uint64_t, 8 > primary)
Definition database.cpp:57
int32_t db_idx64_upperbound(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< uint64_t, 8 > secondary, legacy_ptr< uint64_t, 8 > primary)
Definition database.cpp:63
int32_t db_idx_double_previous(int32_t iterator, legacy_ptr< uint64_t > primary)
Definition database.cpp:221
int32_t db_idx256_next(int32_t iterator, legacy_ptr< uint64_t > primary)
Definition database.cpp:178
int32_t db_idx_double_lowerbound(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< float64_t, 8 > secondary, legacy_ptr< uint64_t, 8 > primary)
Definition database.cpp:203
int32_t db_idx256_upperbound(uint64_t code, uint64_t scope, uint64_t table, legacy_span< uint128_t, 16 > data, legacy_ptr< uint64_t, 8 > primary)
Definition database.cpp:165
int32_t db_idx64_end(uint64_t code, uint64_t scope, uint64_t table)
Definition database.cpp:69
int32_t db_idx_long_double_previous(int32_t iterator, legacy_ptr< uint64_t > primary)
Definition database.cpp:261
int32_t db_idx_double_find_primary(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< float64_t > secondary, uint64_t primary)
Definition database.cpp:200
int32_t db_idx_long_double_store(uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, legacy_ptr< const float128_t > secondary)
Definition database.cpp:228
void db_idx128_remove(int32_t iterator)
Definition database.cpp:89
void db_idx_long_double_remove(int32_t iterator)
Definition database.cpp:234
int32_t db_store_i64(uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, legacy_span< const char > buffer)
Definition database.cpp:8
void db_idx128_update(int32_t iterator, uint64_t payer, legacy_ptr< const uint128_t > secondary)
Definition database.cpp:86
int32_t db_idx128_upperbound(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< uint128_t, 16 > secondary, legacy_ptr< uint64_t, 8 > primary)
Definition database.cpp:104
int32_t db_idx64_find_primary(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< uint64_t > secondary, uint64_t primary)
Definition database.cpp:54
int32_t db_idx_long_double_next(int32_t iterator, legacy_ptr< uint64_t > primary)
Definition database.cpp:258
int32_t db_idx_long_double_find_primary(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< float128_t > secondary, uint64_t primary)
Definition database.cpp:240
int32_t db_idx256_find_secondary(uint64_t code, uint64_t scope, uint64_t table, legacy_span< const uint128_t > data, legacy_ptr< uint64_t > primary)
Definition database.cpp:141
int32_t db_end_i64(uint64_t code, uint64_t scope, uint64_t table)
Definition database.cpp:35
int32_t db_idx_double_upperbound(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< float64_t, 8 > secondary, legacy_ptr< uint64_t, 8 > primary)
Definition database.cpp:209
int32_t db_next_i64(int32_t itr, legacy_ptr< uint64_t > primary)
Definition database.cpp:20
int32_t db_idx64_next(int32_t iterator, legacy_ptr< uint64_t > primary)
Definition database.cpp:72
void db_idx_double_update(int32_t iterator, uint64_t payer, legacy_ptr< const float64_t > secondary)
Definition database.cpp:191
int32_t db_upperbound_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id)
Definition database.cpp:32
int32_t db_idx_double_store(uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, legacy_ptr< const float64_t > secondary)
Definition database.cpp:188
int32_t db_idx_double_find_secondary(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< const float64_t > secondary, legacy_ptr< uint64_t > primary)
Definition database.cpp:197
void db_update_i64(int32_t itr, uint64_t payer, legacy_span< const char > buffer)
Definition database.cpp:11
int32_t db_get_i64(int32_t itr, legacy_span< char > buffer)
Definition database.cpp:17
int32_t db_idx256_store(uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, legacy_span< const uint128_t > data)
Definition database.cpp:124
int32_t db_idx128_find_primary(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< uint128_t > secondary, uint64_t primary)
Definition database.cpp:95
int32_t db_idx128_end(uint64_t code, uint64_t scope, uint64_t table)
Definition database.cpp:110
int32_t db_idx_double_end(uint64_t code, uint64_t scope, uint64_t table)
Definition database.cpp:215
int32_t db_idx64_previous(int32_t iterator, legacy_ptr< uint64_t > primary)
Definition database.cpp:75
int32_t db_idx128_previous(int32_t iterator, legacy_ptr< uint64_t > primary)
Definition database.cpp:116
void db_idx64_update(int32_t iterator, uint64_t payer, legacy_ptr< const uint64_t > secondary)
Definition database.cpp:45
int32_t db_idx64_store(uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, legacy_ptr< const uint64_t > secondary)
Definition database.cpp:42
void db_idx_double_remove(int32_t iterator)
Definition database.cpp:194
int32_t db_idx256_previous(int32_t iterator, legacy_ptr< uint64_t > primary)
Definition database.cpp:181
int32_t db_lowerbound_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id)
Definition database.cpp:29
int32_t db_idx128_find_secondary(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< const uint128_t > secondary, legacy_ptr< uint64_t > primary)
Definition database.cpp:92
int32_t db_idx256_end(uint64_t code, uint64_t scope, uint64_t table)
Definition database.cpp:175
void db_idx64_remove(int32_t iterator)
Definition database.cpp:48
int32_t db_idx256_lowerbound(uint64_t code, uint64_t scope, uint64_t table, legacy_span< uint128_t, 16 > data, legacy_ptr< uint64_t, 8 > primary)
Definition database.cpp:155
int32_t db_idx_long_double_find_secondary(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< const float128_t > secondary, legacy_ptr< uint64_t > primary)
Definition database.cpp:237
void db_idx256_update(int32_t iterator, uint64_t payer, legacy_span< const uint128_t > data)
Definition database.cpp:131
int32_t db_find_i64(uint64_t code, uint64_t scope, uint64_t table, uint64_t id)
Definition database.cpp:26
void db_idx_long_double_update(int32_t iterator, uint64_t payer, legacy_ptr< const float128_t > secondary)
Definition database.cpp:231
int32_t db_idx256_find_primary(uint64_t code, uint64_t scope, uint64_t table, legacy_span< uint128_t > data, uint64_t primary)
Definition database.cpp:148
int32_t db_idx64_find_secondary(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< const uint64_t > secondary, legacy_ptr< uint64_t > primary)
Definition database.cpp:51
void db_idx256_remove(int32_t iterator)
Definition database.cpp:138
int32_t db_idx_double_next(int32_t iterator, legacy_ptr< uint64_t > primary)
Definition database.cpp:218
int32_t db_idx128_lowerbound(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< uint128_t, 16 > secondary, legacy_ptr< uint64_t, 8 > primary)
Definition database.cpp:98
int32_t db_idx_long_double_upperbound(uint64_t code, uint64_t scope, uint64_t table, legacy_ptr< float128_t, 8 > secondary, legacy_ptr< uint64_t, 8 > primary)
Definition database.cpp:249
int32_t db_idx128_store(uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, legacy_ptr< const uint128_t > secondary)
Definition database.cpp:83
int32_t db_idx_long_double_end(uint64_t code, uint64_t scope, uint64_t table)
Definition database.cpp:255
int32_t db_previous_i64(int32_t itr, legacy_ptr< uint64_t > primary)
Definition database.cpp:23
int32_t db_idx128_next(int32_t iterator, legacy_ptr< uint64_t > primary)
Definition database.cpp:113
name account_name
Definition types.hpp:120
unsigned int uint32_t
Definition stdint.h:126
signed int int32_t
Definition stdint.h:123
unsigned __int64 uint64_t
Definition stdint.h:136
CK_RV ret