Xmipp  v3.23.11-Nereus
metadata_query.cpp
Go to the documentation of this file.
1 #include "metadata_query.h"
2 
4 {
5  if (limit == -1 && offset > 0)
6  REPORT_ERROR(ERR_MD_SQL, "Sqlite does not support OFFSET without LIMIT");
7  std::stringstream ss;
8  if (limit != -1)
9  ss << " LIMIT " << limit << " ";
10  if (offset > 0)
11  ss << " OFFSET " << offset << " ";
12  return ss.str();
13 }
14 
16 {
17  std::stringstream ss;
18  ss << "(" << query1->queryStringFunc() << " AND " << query2->queryStringFunc() << ")";
19  return ss.str();
20 }
21 
23 {
24  if (queries.size() > 0)
25  {
26  std::stringstream ss;
27  ss << "(" << queries[0]->queryStringFunc() << ") ";
28  for (size_t i = 1; i < queries.size(); i++)
29  ss << operations[i] << " (" << queries[i]->queryStringFunc() << ") ";
30 
31  return ss.str();
32  }
33  return " ";
34 }
#define REPORT_ERROR(nerr, ErrormMsg)
Definition: xmipp_error.h:211
int limit
If distint of -1 the results will be limited to this value.
int offset
If distint of 0, offset elements will be discarded.
#define i
Error in SQL of MetaData operations.
Definition: xmipp_error.h:159
String limitString() const
virtual String queryStringFunc() const
virtual String queryStringFunc() const
std::string String
Definition: xmipp_strings.h:34
virtual String queryStringFunc() const