Some space operations that accept IEntry argument as a template can also accept SqlQuery instead.
SqlQuery object holds a SQL query WHERE string and a reference to an IEntry object.
? to indicate a value in the IEntry object.
Person personTemplate;
personTemplate.age = 30;
// Match all Person entries where 'name' begins with 'A' and 'age' is older than 30
SqlQuery personQuery(&personTemplate, "name like 'A%' AND age > ?");
// Read all matching Person entries (at most 1000)
std::vector<IEntry*> resultArray = spaceProxy->readMultiple(personQuery,NULL_TX,1000);
Public Member Functions | |
IEntry * | getEntry () const |
std::string | getQuery () const |
Extracts the internal SQL query WHERE clause. | |
void | setEntry (IEntry *entry) |
Sets the entry template. | |
void | setQuery (const std::string &query) |
Sets the internal SQL query WHERE clause. | |
SqlQuery (IEntry *entry, const std::string &sqlQuery) | |
Constructs a SqlQuery object using a given IEntry and a SQL query WHERE clause. | |
SqlQuery () | |
Constructs an empty SqlQuery object. | |
std::string | toString () |
SqlQuery::SqlQuery | ( | ) |
Constructs an empty SqlQuery object.
SqlQuery::SqlQuery | ( | IEntry * | entry, | |
const std::string & | sqlQuery | |||
) |
IEntry * SqlQuery::getEntry | ( | ) | const |
Extracts the internal template entry
std::string SqlQuery::getQuery | ( | ) | const |
Extracts the internal SQL query WHERE clause.
the query
void SqlQuery::setEntry | ( | IEntry * | entry | ) |
Sets the entry template.
entry | - Pointer to an IEntry template object |
entry | to be used as a template to perform the query upon. |
void SqlQuery::setQuery | ( | const std::string & | query | ) |
Sets the internal SQL query WHERE clause.
A | string that holds the SQL query WHERE clause |
className | the className to perform the query upon. |
std::string SqlQuery::toString | ( | ) |
sets the object for the query.
object | to be used as a template to perform the query upon. Returns a string representation of this SQLQuery, in the form of: SELECT * FROM table name WHERE query expression | |
retruns | the sql query |