dm-metamapper 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/dm-metamapper/version.rb +1 -1
- data/lib/templates/cpp/dmmm_dbface.cpp.erb +27 -15
- data/lib/templates/cpp/dmmm_dbface.h.erb +6 -1
- metadata +22 -22
@@ -9,33 +9,33 @@ DBFace* DBFace::_this = NULL;
|
|
9
9
|
|
10
10
|
DBFace::DBFace(const string& database, const string& host,
|
11
11
|
const string& user, const string& password)
|
12
|
-
: _os(NULL)
|
12
|
+
: _os(NULL), _host(host), _user(user), _database(database),
|
13
|
+
_password(password)
|
13
14
|
{
|
14
15
|
_this = this;
|
15
|
-
|
16
|
-
user.c_str(), password.c_str()))
|
17
|
-
{
|
18
|
-
if (_os)
|
19
|
-
(*_os) << "Could not connect to DB";
|
20
|
-
cerr << "Could not connect to DB";
|
21
|
-
exit(-1);
|
22
|
-
}
|
16
|
+
connect();
|
23
17
|
}
|
24
18
|
|
25
19
|
DBFace::DBFace(const string& database, const string& host,
|
26
20
|
const string& user, const string& password,
|
27
21
|
ostream* os)
|
28
|
-
: _os(os)
|
22
|
+
: _os(os), _host(host), _user(user), _database(database),
|
23
|
+
_password(password)
|
29
24
|
{
|
30
25
|
_this = this;
|
31
|
-
|
32
|
-
|
26
|
+
connect();
|
27
|
+
}
|
28
|
+
|
29
|
+
void
|
30
|
+
DBFace::connect()
|
31
|
+
{
|
32
|
+
if (!_connection.connect(_database.c_str(), _host.c_str(),
|
33
|
+
_user.c_str(), _password.c_str()))
|
33
34
|
{
|
34
35
|
if (_os)
|
35
|
-
(*_os) << "Could not connect to DB";
|
36
|
+
(*_os) << "Could not connect to DB";
|
36
37
|
cerr << "Could not connect to DB";
|
37
|
-
|
38
|
-
}
|
38
|
+
}
|
39
39
|
}
|
40
40
|
|
41
41
|
void
|
@@ -82,6 +82,10 @@ DBFace::select(const vector<string>& tables,
|
|
82
82
|
}
|
83
83
|
catch (const mysqlpp::Exception& er) {
|
84
84
|
logError(er.what());
|
85
|
+
if (q.str() == "MySQL server has gone away"){
|
86
|
+
connect();
|
87
|
+
sleep(10);
|
88
|
+
}
|
85
89
|
return false;
|
86
90
|
}
|
87
91
|
|
@@ -114,6 +118,10 @@ DBFace::count(const vector<string>& tables,
|
|
114
118
|
}
|
115
119
|
catch (const mysqlpp::Exception& er) {
|
116
120
|
logError(er.what());
|
121
|
+
if (q.str() == "MySQL server has gone away"){
|
122
|
+
connect();
|
123
|
+
sleep(10);
|
124
|
+
}
|
117
125
|
return false;
|
118
126
|
}
|
119
127
|
|
@@ -151,6 +159,10 @@ DBFace::executeQuery(Query& q)
|
|
151
159
|
}
|
152
160
|
catch (const mysqlpp::Exception& er) {
|
153
161
|
logError(er.what());
|
162
|
+
if (q.str() == "MySQL server has gone away"){
|
163
|
+
connect();
|
164
|
+
sleep(10);
|
165
|
+
}
|
154
166
|
return false;
|
155
167
|
}
|
156
168
|
return true;
|
@@ -20,7 +20,8 @@ public:
|
|
20
20
|
DBFace(const std::string& database, const std::string& host,
|
21
21
|
const std::string& user, const std::string& password,
|
22
22
|
std::ostream* os);
|
23
|
-
|
23
|
+
void connect();
|
24
|
+
|
24
25
|
bool insert(const std::string& table,
|
25
26
|
const std::map<std::string, std::string>& field2Val,
|
26
27
|
size_t& rInsertId);
|
@@ -55,6 +56,10 @@ private:
|
|
55
56
|
mutable boost::mutex _mutex;
|
56
57
|
static DBFace* _this;
|
57
58
|
std::ostream* _os;
|
59
|
+
std::string _host;
|
60
|
+
std::string _user;
|
61
|
+
std::string _database;
|
62
|
+
std::string _password;
|
58
63
|
};
|
59
64
|
|
60
65
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-metamapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jonah Honeyman
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-03-29 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|
@@ -29,34 +29,34 @@ extensions: []
|
|
29
29
|
extra_rdoc_files:
|
30
30
|
- README.md
|
31
31
|
files:
|
32
|
-
- lib/dm-metamapper/
|
33
|
-
- lib/dm-metamapper/model.rb
|
32
|
+
- lib/dm-metamapper/template.rb
|
34
33
|
- lib/dm-metamapper/config.rb
|
34
|
+
- lib/dm-metamapper/metamapper.rb
|
35
|
+
- lib/dm-metamapper/version.rb
|
35
36
|
- lib/dm-metamapper/generators/cpp.rb
|
37
|
+
- lib/dm-metamapper/generator.rb
|
38
|
+
- lib/dm-metamapper/model.rb
|
36
39
|
- lib/dm-metamapper/property.rb
|
37
|
-
- lib/dm-metamapper/version.rb
|
38
|
-
- lib/dm-metamapper/metamapper.rb
|
39
|
-
- lib/dm-metamapper/template.rb
|
40
40
|
- lib/dm-metamapper.rb
|
41
|
+
- lib/templates/cpp/dmmm_utils.cpp.erb~
|
42
|
+
- lib/templates/cpp/dmmm_utils.cpp.erb
|
43
|
+
- lib/templates/cpp/dmmm_dbface.h.erb
|
41
44
|
- lib/templates/cpp/dmmm_fields.hpp~
|
42
|
-
- lib/templates/cpp/
|
43
|
-
- lib/templates/cpp/
|
45
|
+
- lib/templates/cpp/dmmm_comparators.hpp.erb
|
46
|
+
- lib/templates/cpp/dmmm_id.hpp.erb
|
47
|
+
- lib/templates/cpp/dmmm_identifiers.hpp~
|
44
48
|
- lib/templates/cpp/dmmm_id.h~
|
49
|
+
- lib/templates/cpp/dmmm_utils.hpp~
|
45
50
|
- lib/templates/cpp/dmmm_identifiers.hpp.erb
|
46
|
-
- lib/templates/cpp/dmmm_utils.cpp.erb~
|
47
|
-
- lib/templates/cpp/dmmm_dbface.h~
|
48
51
|
- lib/templates/cpp/dmmm_fields.hpp.erb~
|
49
|
-
- lib/templates/cpp/
|
50
|
-
- lib/templates/cpp/
|
52
|
+
- lib/templates/cpp/dmmm_dbface.cpp.erb
|
53
|
+
- lib/templates/cpp/dmmm_dbface.cpp~
|
54
|
+
- lib/templates/cpp/dmmm_dbface.h~
|
51
55
|
- lib/templates/cpp/dmmm_fields.hpp.erb
|
52
|
-
- lib/templates/cpp/dmmm_dbface.h.erb
|
53
56
|
- lib/templates/cpp/instance.hpp.erb
|
54
|
-
- lib/templates/cpp/dmmm_id.hpp.erb
|
55
|
-
- lib/templates/cpp/dmmm_utils.cpp.erb
|
56
|
-
- lib/templates/cpp/dmmm_dbface.cpp~
|
57
57
|
- lib/templates/cpp/dmmm_utils.hpp.erb
|
58
58
|
- lib/templates/cpp/class.hpp.erb
|
59
|
-
- lib/templates/cpp/
|
59
|
+
- lib/templates/cpp/dmmm_comparators.hpp~
|
60
60
|
- README.md
|
61
61
|
has_rdoc: true
|
62
62
|
homepage: http://github.com/jonuts/dm-metamapper
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
requirements: []
|
91
91
|
|
92
92
|
rubyforge_project: dm-metamapper
|
93
|
-
rubygems_version: 1.
|
93
|
+
rubygems_version: 1.6.2
|
94
94
|
signing_key:
|
95
95
|
specification_version: 3
|
96
96
|
summary: Code generating C++ ORM
|