Browse Source

* fix WSqlDatum data<> methods, do not reuse sstream (it appends data ..)

Erik Winn 5 years ago
parent
commit
9a614869e9
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      src/sql/wsqldatum.h

+ 4
- 1
src/sql/wsqldatum.h View File

@@ -21,6 +21,7 @@
21 21
 
22 22
 #include <string>
23 23
 #include <sstream>
24
+#include <iostream>
24 25
 
25 26
 namespace WSql
26 27
 {
@@ -38,11 +39,14 @@ class WSqlDatum
38 39
 			return !operator==( other );
39 40
 		}
40 41
 		template <typename T> void setData( const T t ) {
42
+			std::stringstream _converter;
41 43
 			_converter << t;
44
+			_data.erase();
42 45
 			_data = _converter.str();
43 46
 		};
44 47
 
45 48
 		template <typename T> T data(){
49
+		std::stringstream _converter;
46 50
 			T result;
47 51
 			_converter << _data;
48 52
 			_converter >> result;
@@ -64,7 +68,6 @@ class WSqlDatum
64 68
 		void clear();
65 69
 	private:
66 70
 		std::string _data;
67
-		std::stringstream _converter;
68 71
 
69 72
 };
70 73