MCPcopy Create free account
hub / github.com/acl-dev/acl / mod

Method mod

lib_acl_cpp/src/hsocket/hsclient.cpp:209–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209bool hsclient::mod(const char* values[], int num,
210 const char* to_values[], int to_num, const char* cond /* = "=" */,
211 int nlimit /* = 0 */, int noffset /* = 0 */)
212{
213 if (tbl_curr_ == NULL) {
214 error_ = HS_ERR_NOT_OPEN;
215 logger_error("tbl not opened yet!");
216 return false;
217 } else if (values == NULL || values[0] == NULL) {
218 error_ = HS_ERR_PARAMS;
219 logger_error("values null");
220 return false;
221 } else if (num <= 0 || num > tbl_curr_->nfld_) {
222 error_ = HS_ERR_PARAMS;
223 logger_error("num(%d) invalid, nfld(%d)",
224 num, tbl_curr_->nfld_);
225 return false;
226 } else if (cond == NULL || *cond == 0) {
227 error_ = HS_ERR_PARAMS;
228 logger_error("cond null");
229 return false;
230 } else if (to_values == NULL || to_values[0] == NULL) {
231 error_ = HS_ERR_PARAMS;
232 logger_error("to_values null");
233 return false;
234 } else if (to_num <= 0 || to_num > tbl_curr_->nfld_) {
235 error_ = HS_ERR_PARAMS;
236 logger_error("to_num(%d) invalid, nfld(%d)",
237 to_num, tbl_curr_->nfld_);
238 return false;
239 }
240
241 if (nlimit <= 0) {
242 nlimit = MAX_INT;
243 }
244 if (noffset < 0) {
245 noffset = 0;
246 }
247 char buf[32];
248 safe_snprintf(buf, sizeof(buf), "%d\t%d", nlimit, noffset);
249 return query(cond, values, num, buf, 'U', to_values, to_num);
250}
251
252bool hsclient::del(const char* values[], int num,
253 const char* cond /* = "=" */, int nlimit /* = 1 */, int noffset /* = 0 */)

Callers 2

hs_updateFunction · 0.80
hspool_updateFunction · 0.80

Calls 2

safe_snprintfFunction · 0.85
queryClass · 0.50

Tested by

no test coverage detected