SqlQuery Class Reference

List of all members.


Detailed Description

Provides an interface to use SQL queries when accessing entries in the Space.

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.

Note:
The SQL query string:
Sample usage:


 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);
 

See also:
SpaceProxy, IEntry

Public Member Functions

IEntrygetEntry () 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 ()

Constructor & Destructor Documentation

SqlQuery::SqlQuery (  ) 

Constructs an empty SqlQuery object.

SqlQuery::SqlQuery ( IEntry entry,
const std::string &  sqlQuery 
)

Constructs a SqlQuery object using a given IEntry and a SQL query WHERE clause.

Parameters:
entry - Acts as a template to the query
sqlQuery - SQL query WHERE clause


Member Function Documentation

IEntry * SqlQuery::getEntry (  )  const

Extracts the internal template entry

Returns:
Pointer to the internal IEntry object
Extract the Entry for the current query.
Returns:
the entry of the query

std::string SqlQuery::getQuery (  )  const

Extracts the internal SQL query WHERE clause.

Returns:
A string that holds the internal SQL query WHERE clause
Extract the object for the current query.
Returns:
the object of the query Extract the query.

the query

void SqlQuery::setEntry ( IEntry entry  ) 

Sets the entry template.

Parameters:
entry - Pointer to an IEntry template object
sets the entry for the query.
Parameters:
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.

Parameters:
A string that holds the SQL query WHERE clause
sets the className that the query.
Parameters:
className the className to perform the query upon.

std::string SqlQuery::toString (  ) 

sets the object for the query.

Parameters:
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


Generated on Thu Jul 22 08:11:55 2010 for GigaSpaces XAP 10.1 C++ by  doxygen 1.5.3