ARC SDK
Public Member Functions
Arc::Query Class Referenceabstract

Class representing a database query. More...

#include <arc/DBInterface.h>

Inheritance diagram for Arc::Query:
Arc::MySQLQuery

Public Member Functions

 Query ()
 Default constructor. More...
 
 Query (Database *db)
 Constructor. More...
 
virtual ~Query ()
 Deconstructor. More...
 
virtual int get_num_colums ()=0
 Get the column number in the query result. More...
 
virtual int get_num_rows ()=0
 Get the row number in the query result. More...
 
virtual bool execute (const std::string &sqlstr)=0
 Execute the query. More...
 
virtual QueryRowResult get_row (int row_number) const =0
 Get the value of one row in the query result. More...
 
virtual QueryRowResult get_row () const =0
 Get the value of one row in the query result. More...
 
virtual std::string get_row_field (int row_number, std::string &field_name)=0
 Get the value of one specific field in one specific row. More...
 
virtual bool get_array (std::string &sqlstr, QueryArrayResult &result, std::vector< std::string > &arguments)=0
 Query the database by using some parameters into sql sentence. More...
 

Detailed Description

Class representing a database query.

Constructor & Destructor Documentation

◆ Query() [1/2]

Arc::Query::Query ( )
inline

Default constructor.

◆ Query() [2/2]

Arc::Query::Query ( Database db)
inline

Constructor.

Parameters
dbThe database object which will be used by Query class to get the database connection

◆ ~Query()

virtual Arc::Query::~Query ( )
inlinevirtual

Deconstructor.

Member Function Documentation

◆ execute()

virtual bool Arc::Query::execute ( const std::string &  sqlstr)
pure virtual

Execute the query.

Parameters
sqlstrThe sql sentence used to query

Implemented in Arc::MySQLQuery.

◆ get_array()

virtual bool Arc::Query::get_array ( std::string &  sqlstr,
QueryArrayResult &  result,
std::vector< std::string > &  arguments 
)
pure virtual

Query the database by using some parameters into sql sentence.

An example sentence: "select table.value from table where table.name = ?"

Parameters
sqlstrThe sql sentence with some parameters marked with "?".
resultThe result in an array which includes all of the value in query result.
argumentsThe argument list which should exactly correspond with the parameters in the sql sentence.

Implemented in Arc::MySQLQuery.

◆ get_num_colums()

virtual int Arc::Query::get_num_colums ( )
pure virtual

Get the column number in the query result.

Implemented in Arc::MySQLQuery.

◆ get_num_rows()

virtual int Arc::Query::get_num_rows ( )
pure virtual

Get the row number in the query result.

Implemented in Arc::MySQLQuery.

◆ get_row() [1/2]

virtual QueryRowResult Arc::Query::get_row ( int  row_number) const
pure virtual

Get the value of one row in the query result.

Parameters
row_numberThe number of the row
Returns
A vector includes all the values in the row

Implemented in Arc::MySQLQuery.

◆ get_row() [2/2]

virtual QueryRowResult Arc::Query::get_row ( ) const
pure virtual

Get the value of one row in the query result.

The row number will be automatically increased each time the method is called.

Implemented in Arc::MySQLQuery.

◆ get_row_field()

virtual std::string Arc::Query::get_row_field ( int  row_number,
std::string &  field_name 
)
pure virtual

Get the value of one specific field in one specific row.

Parameters
row_numberThe row number inside the query result
field_nameThe field name for the value which will be return
Returns
The value of the specified filed in the specified row

Implemented in Arc::MySQLQuery.


The documentation for this class was generated from the following file: