BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Calibration/rdbModel/include/rdbModel/Db/MysqlResults.h
Go to the documentation of this file.
1// $Header: /bes/bes/BossCvs/Calibration/rdbModel/rdbModel/Db/MysqlResults.h,v 1.2 2008/04/09
2// 02:57:28 huangb Exp $
3#ifndef RDBMODEL_MYSQLRESULTS_H
4#define RDBMODEL_MYSQLRESULTS_H
5
6#include "rdbModel/Db/ResultHandle.h"
7
8typedef struct st_mysql_res MYSQL_RES;
9
10namespace rdbModel {
11
12 class MysqlConnection;
13
14 /**
15 Concrete implementation of ResultHandle, to accompany MysqlConnection.
16 */
17 class MysqlResults : virtual public ResultHandle {
18 friend class MysqlConnection;
19
20 public:
21 virtual ~MysqlResults();
22
23 /// Return number of rows in results
24 virtual unsigned int getNRows() const;
25
26 /**
27 Get array of field values for ith row of result set
28 */
29 virtual bool getRow( std::vector<std::string>& fields, unsigned int i = 0,
30 bool clear = true );
31
32 /**
33 Get array of field values for ith row of result set. If a field
34 value is NULL, return a zero ptr for that element of the array.
35
36 --> It is the responsibility of the caller to delete the strings
37 containing the field values. See service cleanFieldPtrs
38 in base class ResultHandle.
39 */
40 virtual bool getRowPtrs( std::vector<std::string*>& fieldPtrs, unsigned int i = 0,
41 bool clear = true );
42
43 virtual bool getRowCon( char* par, unsigned long* treesize, unsigned int* runFrm,
44 unsigned int* runTo, unsigned int i = 0, bool clear = true );
45 /*
46 // Return specified row in results as a string
47 virtual bool getRowString(std::string& row, unsigned int iRow=0) const;
48
49 Return vector of rows
50 @param rows to hold returned data
51 @param iRow starting row
52 @param maxRow maximum number of rows requested. 0 means "all"
53 @param clear if true, clear @a rows before storing new data
54 @return status
55
56 virtual bool getRowStrings(std::vector<std::string>& rows,
57 unsigned int iRow=0,
58 unsigned int maxRow=0, bool clear=true) const;
59 */
60
61 private:
62 // Only MysqlConnection calls constructor
63 MysqlResults( MYSQL_RES* results = 0 );
64
65 MYSQL_RES* m_myres;
66 };
67} // namespace rdbModel
68#endif
virtual bool getRow(std::vector< std::string > &fields, unsigned int i=0, bool clear=true)
virtual bool getRowCon(char *par, unsigned long *treesize, unsigned int *runFrm, unsigned int *runTo, unsigned int i=0, bool clear=true)
virtual unsigned int getNRows() const
Return number of rows in results.
virtual bool getRowPtrs(std::vector< std::string * > &fieldPtrs, unsigned int i=0, bool clear=true)