LiteSQL
odbc_backend.hpp
1 /* LiteSQL
2  *
3  * The list of contributors at http://litesql.sf.net/
4  *
5  * See LICENSE for copyright information. */
6 
9 #ifndef _litesql_odbc_backend_hpp
10 #define _litesql_odbc_backend_hpp
11 #ifdef HAVE_ODBC
12 //#include <windows.h>
13 //#include <sql.h>
14 //#include <sqlext.h>
15 
16 
17 #include "litesql/except.hpp"
18 #include "litesql/types.hpp"
19 #include "litesql/string.hpp"
20 #include "litesql/backend.hpp"
21 
22 #include <string>
23 
24 namespace litesql {
25 using namespace std;
27 class ODBCBackend : public Backend {
28  mutable bool transaction;
29 protected:
30  void throwError(int status) const;
31 public:
33  class Result : public Backend::Result {
34  public:
35  Records recs;
36  Record flds;
37  Result() {}
38  virtual size_t fieldNum() const;
39  virtual Record fields() const;
40  virtual size_t recordNum() const;
41  virtual Records records() const;
42  const Records& recordsRef() const;
43  };
45  class Cursor : public Backend::Cursor {
46  //HDBC* db;
47  //HSTMT* stmt;
48  const ODBCBackend& owner;
49  public:
50  Cursor(/*HDBC* db, HSTMT* s,*/ const ODBCBackend& owner);
51  virtual Record fetchOne();
52  virtual ~Cursor();
53  };
54  ODBCBackend(const std::string& database);
55  virtual bool supportsSequences() const;
56  virtual std::string getInsertID() const;
57  virtual void begin() const;
58  virtual void commit() const;
59  virtual void rollback() const;
60  Backend::Result* execute(const std::string& query) const;
61  Backend::Cursor* cursor(const std::string& query) const;
62  virtual ~ODBCBackend();
63 };
64 }
65 #endif
66 #endif
Classes Backend, Backend::Cursor and Backend::Result.
contains litesql's exception classes
helpful string utils
contains class Record and typedef Records
std::vector< Record > Records
shortcut
Definition: types.hpp:26

SourceForge.net Logo