nodejs-db-informix  master
nodejs bindings for Informix
 All Classes Functions Pages
result.h
1 #ifndef __INF_RESULT_H_INCLUDED__
2 #define __INF_RESULT_H_INCLUDED__
3 
4 #include <it.h>
5 #include <string>
6 #include <vector>
7 #include <stdexcept>
8 #include "nodejs-db/exception.h"
9 #include "nodejs-db/result.h"
10 
11 #include <ostream>
12 
13 namespace nodejs_db_informix {
14 class Result : public nodejs_db::Result {
15  public:
17  public:
18  explicit Column(const std::string n, const ITTypeInfo *column) throw(nodejs_db::Exception&);
19  ~Column();
20  bool isBinary() const;
21  std::string getName() const;
22  std::string getTypeName() const;
23  nodejs_db::Result::Column::type_t getType() const;
24 
25  friend std::ostream& operator<< (std::ostream &o, const Column &c) {
26  o << "Column { name: " << c.name
27  << ", typeName: " << c.typeName
28  << ", type: " << c.type
29  << ", binary: " << c.binary
30  << " }"
31  ;
32 
33  return o;
34  }
35 
36  protected:
37  std::string name;
38  std::string typeName;
39  type_t type;
40  bool binary;
41  };
42 
43  explicit Result(ITBool b, long re = 0) throw(nodejs_db::Exception&);
44  explicit Result(ITSet* rs, long re = 0) throw(nodejs_db::Exception&);
45  explicit Result(ITSet* rs, const ITTypeInfo *cti, long re = 0) throw(nodejs_db::Exception&);
46  ~Result();
47  void release() throw();
48  bool hasNext() const throw();
49  std::vector<std::string>* next() throw(nodejs_db::Exception&);
50  unsigned long* columnLengths() throw(nodejs_db::Exception&);
51  uint64_t index() const throw(std::out_of_range&);
52  Column* column(uint16_t i) const throw(std::out_of_range&);
53  uint64_t insertId() const throw();
54  uint16_t columnCount() const throw();
55  uint64_t affectedCount() const throw();
56  uint16_t warningCount() const throw();
57  uint64_t count() const throw(nodejs_db::Exception&);
58  bool isBuffered() const throw();
59  bool isEmpty() const throw();
60 
61  protected:
62  std::vector<Column*> columns;
63  std::vector<std::string> columnNames;
64  unsigned long *colLengths;
65  uint16_t totalColumns;
66  uint64_t rowNumber;
67  long rowsAffected;
68  bool empty;
69 
70  std::vector<std::string>* row() throw(nodejs_db::Exception&);
71  void free() throw();
72 
73  private:
74  ITSet* resultSet;
75  std::vector<std::string>* previousRow;
76  std::vector<std::string>* nextRow;
77 };
78 }
79 
80 #endif // __INF_RESULT_H_INCLUDED__