-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpg_string.cpp
61 lines (54 loc) · 1.04 KB
/
pg_string.cpp
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
52
53
54
55
56
57
58
59
60
#include "./pg_string.h"
PGString::PGString(PGresult* result, const std::string& str) : result_(result), str_(str)
{
}
PGString::operator double()
{
try {
return std::stod(str_);
} catch(std::exception& e) {
return 0;
}
}
PGString::operator int()
{
try {
return std::stoi(str_);
} catch(std::exception& e) {
return 0;
}
}
PGString::operator unsigned int()
{
try {
return std::stoul(str_);
} catch(std::exception& e) {
return 0;
}
}
PGString::operator long()
{
try {
return std::stol(str_);
} catch(std::exception& e) {
return 0;
}
}
PGString::operator unsigned long()
{
try {
return std::stoul(str_);
} catch(std::exception& e) {
return 0;
}
}
PGString::operator std::string()
{
return str_;
}
//gzrd_Lib_CPP_Version_ID--start
#ifndef GZRD_SVN_ATTR
#define GZRD_SVN_ATTR "0"
#endif
static char gzrd_Lib_CPP_Version_ID[] __attribute__((used))="$HeadURL$ $Id$ " GZRD_SVN_ATTR "__file__";
// gzrd_Lib_CPP_Version_ID--end