Merge lp:~linuxjedi/drizzle/elliott-bug-653300 into lp:drizzle/7.0

Proposed by Andrew Hutchings
Status: Merged
Approved by: Brian Aker
Approved revision: 1804
Merge reported by: Lee Bieber
Merged at revision: not available
Proposed branch: lp:~linuxjedi/drizzle/elliott-bug-653300
Merge into: lp:drizzle/7.0
Diff against target: 121 lines (+16/-13)
4 files modified
client/drizzledump_data.cc (+2/-2)
client/drizzledump_data.h (+1/-1)
client/drizzledump_mysql.cc (+12/-9)
client/drizzledump_mysql.h (+1/-1)
To merge this branch: bzr merge lp:~linuxjedi/drizzle/elliott-bug-653300
Reviewer Review Type Date Requested Status
Drizzle Merge Team Pending
Review via email: mp+37330@code.launchpad.net

Description of the change

1. date 0000-00-00 regex bug fixed
2. date/time conversion was also sending a pointer to output
3. a '%' was sent to progress output
4. disable not null dates for conversion as data may contain 0000-00-00 which turns into null

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client/drizzledump_data.cc'
2--- client/drizzledump_data.cc 2010-09-24 14:56:23 +0000
3+++ client/drizzledump_data.cc 2010-10-01 23:32:46 +0000
4@@ -242,7 +242,7 @@
5 rownr++;
6 if ((rownr % show_progress_size) == 0)
7 {
8- std::cerr << "-- %" << rownr << _(" rows dumped for table ") << obj.table->displayName << std::endl;
9+ std::cerr << "-- " << rownr << _(" rows dumped for table ") << obj.table->displayName << std::endl;
10 }
11
12 size_t* row_sizes= drizzle_row_field_sizes(obj.result);
13@@ -279,7 +279,7 @@
14 /* time/date conversion for MySQL connections */
15 else if (obj.table->fields[i]->convertDateTime)
16 {
17- os << obj.checkDateTime(os, row[i], i);
18+ os << obj.checkDateTime(row[i], i);
19 }
20 else
21 {
22
23=== modified file 'client/drizzledump_data.h'
24--- client/drizzledump_data.h 2010-09-24 14:56:23 +0000
25+++ client/drizzledump_data.h 2010-10-01 23:32:46 +0000
26@@ -162,7 +162,7 @@
27 virtual ~DrizzleDumpData() { }
28 friend std::ostream& operator <<(std::ostream &os, const DrizzleDumpData &obj);
29
30- virtual std::ostream& checkDateTime(std::ostream &os, const char*, uint32_t) const { return os; }
31+ virtual std::string checkDateTime(const char*, uint32_t) const { return std::string(""); }
32 std::string convertHex(const unsigned char* from, size_t from_size) const;
33 std::string escape(const char* from, size_t from_size) const;
34 };
35
36=== modified file 'client/drizzledump_mysql.cc'
37--- client/drizzledump_mysql.cc 2010-09-24 13:38:21 +0000
38+++ client/drizzledump_mysql.cc 2010-10-01 23:32:46 +0000
39@@ -169,6 +169,7 @@
40 field->convertDateTime= false;
41 /* Also sets collation */
42 field->setType(row[1], row[8]);
43+ field->isNull= (strcmp(row[3], "YES") == 0) ? true : false;
44 if (row[2])
45 {
46 if (field->convertDateTime)
47@@ -181,7 +182,6 @@
48 else
49 field->defaultValue= "";
50
51- field->isNull= (strcmp(row[3], "YES") == 0) ? true : false;
52 field->isAutoIncrement= (strcmp(row[8], "auto_increment") == 0) ? true : false;
53 field->defaultIsNull= field->isNull;
54 field->length= (row[4]) ? boost::lexical_cast<uint32_t>(row[4]) : 0;
55@@ -216,9 +216,9 @@
56 return;
57 }
58
59- boost::regex date_regex("([0-9]{3}[1-9]-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]))");
60+ boost::regex date_regex("(0000|-00)");
61
62- if (regex_search(oldDefault, date_regex, flags))
63+ if (not regex_search(oldDefault, date_regex, flags))
64 {
65 defaultValue= oldDefault;
66 }
67@@ -227,6 +227,7 @@
68 defaultIsNull= true;
69 defaultValue="";
70 }
71+ isNull= true;
72 }
73
74
75@@ -464,9 +465,9 @@
76 {
77 boost::match_flag_type flags = boost::match_default;
78 std::string output;
79- boost::regex date_regex("([0-9]{3}[1-9]-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]))");
80+ boost::regex date_regex("(0000|-00)");
81
82- if (regex_search(oldDate, date_regex, flags))
83+ if (not regex_search(oldDate, date_regex, flags))
84 {
85 output.push_back('\'');
86 output.append(oldDate);
87@@ -478,15 +479,17 @@
88 return output;
89 }
90
91-std::ostream& DrizzleDumpDataMySQL::checkDateTime(std::ostream &os, const char* item, uint32_t field) const
92+std::string DrizzleDumpDataMySQL::checkDateTime(const char* item, uint32_t field) const
93 {
94+ std::string ret;
95+
96 if (table->fields[field]->convertDateTime)
97 {
98 if (table->fields[field]->type.compare("INT") == 0)
99- os << convertTime(item);
100+ ret= boost::lexical_cast<std::string>(convertTime(item));
101 else
102- os << convertDate(item);
103+ ret= convertDate(item);
104 }
105- return os;
106+ return ret;
107 }
108
109
110=== modified file 'client/drizzledump_mysql.h'
111--- client/drizzledump_mysql.h 2010-09-23 20:32:31 +0000
112+++ client/drizzledump_mysql.h 2010-10-01 23:32:46 +0000
113@@ -100,7 +100,7 @@
114 std::string convertDate(const char* oldDate) const;
115 /* For xx:xx:xx -> INT conversion */
116 long convertTime(const char* oldTime) const;
117- std::ostream& checkDateTime(std::ostream &os, const char* item, uint32_t field) const;
118+ std::string checkDateTime(const char* item, uint32_t field) const;
119 };
120
121 #endif /* CLIENT_DRIZZLEDUMP_MYSQL_H */

Subscribers

People subscribed via source and target branches