dm-metamapper 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  module DataMapper
2
2
  module MetaMapper
3
- VERSION = "0.1.2" unless defined?(::DataMapper::MetaMapper::VERSION)
3
+ VERSION = "0.1.3" unless defined?(::DataMapper::MetaMapper::VERSION)
4
4
  end
5
5
 
6
6
  end
@@ -2,7 +2,8 @@
2
2
  #include "dmmm_utils.hpp"
3
3
  using namespace mysqlpp;
4
4
  using namespace std;
5
- using namespace DMMM;
5
+
6
+ namespace DMMM {
6
7
 
7
8
  DBFace* DBFace::_this = NULL;
8
9
 
@@ -191,7 +192,7 @@ DBFace::insert(const string& table,
191
192
  for(size_t j = 0; j < rows[i].size(); ++j){
192
193
  if (j != 0)
193
194
  q << ",";
194
- q << quote << rows[i][j];
195
+ q << rows[i][j];
195
196
  }
196
197
  q << ")";
197
198
  }
@@ -225,7 +226,7 @@ DBFace::insert(const string& table,
225
226
  {
226
227
  if (it != field2Val.begin())
227
228
  q << ",";
228
- q << quote << it->second;
229
+ q << it->second;
229
230
  }
230
231
  q << ")";
231
232
  log(q.str());
@@ -248,7 +249,7 @@ DBFace::update(const string& table,
248
249
  {
249
250
  if (it != field2Val.begin())
250
251
  q << ",";
251
- q << it->first << "=" << quote << it->second;
252
+ q << it->first << "=" << it->second;
252
253
  }
253
254
  if (where.size())
254
255
  q << " WHERE " << where;
@@ -274,3 +275,5 @@ DBFace::now()
274
275
  }
275
276
  return UTILS::toString(mysqlRes[0]["now()"]);
276
277
  }
278
+
279
+ } //namespace DMMM
@@ -5,6 +5,7 @@
5
5
  #include <iosfwd>
6
6
  #include <mysql++.h>
7
7
  #include <boost/thread/mutex.hpp>
8
+ #include "dmmm_id.hpp"
8
9
 
9
10
  namespace DMMM {
10
11
 
@@ -56,6 +57,30 @@ private:
56
57
  std::ostream* _os;
57
58
  };
58
59
 
60
+
61
+
62
+
63
+ template<class T>
64
+ std::string
65
+ toSQLString(const ID::Id<T>& id)
66
+ {
67
+ mysqlpp::Query q(0);
68
+ q << mysqlpp::quote << id.to_s();
69
+
70
+ return q.str();
71
+ }
72
+
73
+ template<class T>
74
+ std::string
75
+ toSQLString(const T& t)
76
+ {
77
+ mysqlpp::Query q(0);
78
+ q << mysqlpp::quote << t;
79
+
80
+ return q.str();
81
+ }
82
+
83
+
59
84
  } //namespace DMMM
60
85
 
61
86
  #endif //DB_H
@@ -57,7 +57,7 @@ public:
57
57
  <%- model.generated_properties.each do |property| -%>
58
58
  if (_f_<%= property.name %>._dirty)
59
59
  field2Val["<%= property.name %>"] =
60
- UTILS::toString(_f_<%= property.name %>._base);
60
+ toSQLString(_f_<%= property.name %>._base);
61
61
  <%- end -%>
62
62
  std::string where =
63
63
  "<%= model.serial.name %>=" + UTILS::toString(_f_<%= model.serial.name %>._base);
@@ -79,7 +79,7 @@ public:
79
79
  <%- model.generated_properties.each do |property| -%>
80
80
  if (_f_<%= property.name %>._dirty)
81
81
  field2Val["<%= property.name %>"] =
82
- UTILS::toString(_f_<%= property.name %>._base);
82
+ toSQLString(_f_<%= property.name %>._base);
83
83
  <%- end -%>
84
84
  <% if model.serial %>
85
85
  if (DBFace::instance()->
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: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
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-02-08 00:00:00 +02:00
19
+ date: 2011-02-22 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies: []
22
22