summaryrefslogtreecommitdiff
path: root/libodbcpp/command.h
blob: fdabe4acf69b5a172a2aa7ea0ce2e52c37c070ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef ODBC_COMMAND_H
#define ODBC_COMMAND_H

#include "../libdbpp/command.h"
#include <vector>
#include "connection.h"
#include <glibmm/ustring.h>

namespace ODBC {
	class Param;
	class Command : public virtual DB::Command {
			typedef std::vector<Param*> Params;
		public:
			Command(const Connection &, const std::string & sql);
			virtual ~Command() = 0;

			void				bindParamI(unsigned int i, int val);
			void				bindParamI(unsigned int i, long val);
			void				bindParamI(unsigned int i, long long val);
			void				bindParamI(unsigned int i, unsigned int val);
			void				bindParamI(unsigned int i, unsigned long int val);
			void				bindParamI(unsigned int i, unsigned long long int val);

			void				bindParamF(unsigned int i, double val);
			void				bindParamF(unsigned int i, float val);

			void				bindParamS(unsigned int i, const Glib::ustring &);

			void				bindParamT(unsigned int i, const struct tm *);
			void				bindParamT(unsigned int i, const SQL_TIMESTAMP_STRUCT &);
			void				bindParamT(unsigned int i, time_t);

			void				bindNull(unsigned int i);

		protected:
			friend class Param;
			friend class Column;
			SQLHSTMT        	hStmt;
			const Connection&	connection;
		private:
			Params				params;

			template <class ParamType>
				ParamType *
				makeParam(unsigned int idx);
	};

}

#endif