Class representing a database query.  
 More...
#include <arc/DBInterface.h>
 | 
|   | 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...
  | 
|   | 
Class representing a database query. 
 
◆ Query() [1/2]
◆ Query() [2/2]
Constructor. 
- Parameters
 - 
  
    | db | The database object which will be used by Query class to get the database connection  | 
  
   
 
 
◆ ~Query()
  
  
      
        
          | virtual Arc::Query::~Query  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlinevirtual   | 
  
 
 
◆ execute()
  
  
      
        
          | virtual bool Arc::Query::execute  | 
          ( | 
          const std::string &  | 
          sqlstr | ) | 
           | 
         
       
   | 
  
pure virtual   | 
  
 
Execute the query. 
- Parameters
 - 
  
    | sqlstr | The 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
 - 
  
    | sqlstr | The sql sentence with some parameters marked with "?".  | 
    | result | The result in an array which includes all of the value in query result.  | 
    | arguments | The 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_num_rows()
  
  
      
        
          | virtual int Arc::Query::get_num_rows  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
pure virtual   | 
  
 
 
◆ 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_number | The 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_number | The row number inside the query result  | 
    | field_name | The 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: