-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmysql_stmt.hpp
More file actions
48 lines (36 loc) · 1.12 KB
/
Copy pathmysql_stmt.hpp
File metadata and controls
48 lines (36 loc) · 1.12 KB
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
/// mysql_stmt.hpp -- mysql statement decls
/// Author: Zhang Yichao <echaozh@gmail.com>
/// Created: 2011-08-03
///
#ifndef INCLUDED_MYSQL_STMT_HPP
#define INCLUDED_MYSQL_STMT_HPP
#include <mysql/mysql.h>
#include <deque>
#include <string>
struct vconf_url;
enum bind_type
{
null, integer, unsigned_int, floating_point, text, binary, timestamp,
};
struct mysql_stmt
{
mysql_stmt (const std::string &n, const std::string &s, bool i,
const std::string &f, size_t l)
: name (n), sql (s), insert_id (i), file (f), lineno (l),
is_query (true) {}
MYSQL_STMT *prepare (MYSQL *conn) const;
void init_results (MYSQL *&conn, const std::string &host,
unsigned short port, const std::string &user,
const std::string &password, const std::string &db,
size_t timeout);
std::string name;
std::string sql;
bool insert_id;
std::string file;
size_t lineno;
bool is_query;
std::deque<bind_type> results;
private:
bind_type translate_type (MYSQL_FIELD *field);
};
#endif // INCLUDED_MYSQL_STMT_HPP