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

Proposed by Andrew Hutchings
Status: Merged
Approved by: Brian Aker
Approved revision: 1811
Merge reported by: Lee Bieber
Merged at revision: not available
Proposed branch: lp:~linuxjedi/drizzle/elliott-bug-651950
Merge into: lp:drizzle/7.0
Diff against target: 123 lines (+25/-6)
4 files modified
client/drizzledump_data.cc (+10/-3)
client/drizzledump_data.h (+2/-1)
client/drizzledump_drizzle.cc (+6/-1)
client/drizzledump_mysql.cc (+7/-1)
To merge this branch: bzr merge lp:~linuxjedi/drizzle/elliott-bug-651950
Reviewer Review Type Date Requested Status
Drizzle Merge Team Pending
Review via email: mp+37486@code.launchpad.net
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-10-02 14:41:31 +0000
3+++ client/drizzledump_data.cc 2010-10-04 15:27:46 +0000
4@@ -306,7 +306,7 @@
5 (obj.table->fields[i]->type.compare("VARBINARY") == 0)))
6 os << obj.convertHex((unsigned char*)row[i], row_sizes[i]);
7 else
8- os << "'" << obj.escape(row[i], row_sizes[i]) << "'";
9+ os << "'" << DrizzleDumpData::escape(row[i], row_sizes[i]) << "'";
10 }
11 else
12 os << row[i];
13@@ -353,7 +353,7 @@
14 }
15
16 /* Ripped out of libdrizzle, hopefully a little safer */
17-std::string DrizzleDumpData::escape(const char* from, size_t from_size) const
18+std::string DrizzleDumpData::escape(const char* from, size_t from_size)
19 {
20 std::string output;
21
22@@ -421,7 +421,14 @@
23 os << "AUTO_INCREMENT=" << obj.autoIncrement << " ";
24 }
25
26- os << "COLLATE = " << obj.collate << ";" << std::endl << std::endl;
27+ os << "COLLATE = " << obj.collate;
28+
29+ if (not obj.comment.empty())
30+ {
31+ os << " COMMENT = '" << obj.comment << "'";
32+ }
33+
34+ os << ";" << std::endl << std::endl;
35
36 return os;
37 }
38
39=== modified file 'client/drizzledump_data.h'
40--- client/drizzledump_data.h 2010-09-30 13:36:29 +0000
41+++ client/drizzledump_data.h 2010-10-04 15:27:46 +0000
42@@ -116,6 +116,7 @@
43 std::string displayName;
44 std::string engineName;
45 std::string collate;
46+ std::string comment;
47
48 // Currently MySQL only, hard to do in Drizzle
49 uint64_t autoIncrement;
50@@ -165,7 +166,7 @@
51
52 virtual std::ostream& checkDateTime(std::ostream &os, const char*, uint32_t) const { return os; }
53 std::string convertHex(const unsigned char* from, size_t from_size) const;
54- std::string escape(const char* from, size_t from_size) const;
55+ static std::string escape(const char* from, size_t from_size);
56 };
57
58 class DrizzleDumpConnection
59
60=== modified file 'client/drizzledump_drizzle.cc'
61--- client/drizzledump_drizzle.cc 2010-10-02 14:37:55 +0000
62+++ client/drizzledump_drizzle.cc 2010-10-04 15:27:46 +0000
63@@ -40,7 +40,7 @@
64 if (verbose)
65 std::cerr << _("-- Retrieving table structures for ") << databaseName << "..." << std::endl;
66
67- query="SELECT TABLE_NAME, TABLE_COLLATION, ENGINE, AUTO_INCREMENT FROM DATA_DICTIONARY.TABLES WHERE TABLE_SCHEMA='";
68+ query="SELECT TABLE_NAME, TABLE_COLLATION, ENGINE, AUTO_INCREMENT, TABLE_COMMENT FROM DATA_DICTIONARY.TABLES WHERE TABLE_SCHEMA='";
69 query.append(databaseName);
70 query.append("' ORDER BY TABLE_NAME");
71
72@@ -51,6 +51,7 @@
73
74 while ((row= drizzle_row_next(result)))
75 {
76+ size_t* row_sizes= drizzle_row_field_sizes(result);
77 std::string tableName(row[0]);
78 std::string displayName(tableName);
79 cleanTableName(displayName);
80@@ -62,6 +63,10 @@
81 table->collate= row[1];
82 table->engineName= row[2];
83 table->autoIncrement= boost::lexical_cast<uint64_t>(row[3]);
84+ if (row[4])
85+ table->comment= DrizzleDumpData::escape(row[4], row_sizes[4]);
86+ else
87+ table->comment= "";
88 table->database= this;
89 if ((not table->populateFields()) or (not table->populateIndexes()))
90 {
91
92=== modified file 'client/drizzledump_mysql.cc'
93--- client/drizzledump_mysql.cc 2010-10-02 14:36:07 +0000
94+++ client/drizzledump_mysql.cc 2010-10-04 15:27:46 +0000
95@@ -41,7 +41,7 @@
96 if (verbose)
97 std::cerr << _("-- Retrieving table structures for ") << databaseName << "..." << std::endl;
98
99- query="SELECT TABLE_NAME, TABLE_COLLATION, ENGINE, AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE != 'VIEW' AND TABLE_SCHEMA='";
100+ query="SELECT TABLE_NAME, TABLE_COLLATION, ENGINE, AUTO_INCREMENT, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE != 'VIEW' AND TABLE_SCHEMA='";
101 query.append(databaseName);
102 query.append("' ORDER BY TABLE_NAME");
103
104@@ -52,6 +52,7 @@
105
106 while ((row= drizzle_row_next(result)))
107 {
108+ size_t* row_sizes= drizzle_row_field_sizes(result);
109 std::string tableName(row[0]);
110 std::string displayName(tableName);
111 cleanTableName(displayName);
112@@ -67,6 +68,11 @@
113 else
114 table->autoIncrement= 0;
115
116+ if (row[4])
117+ table->comment= DrizzleDumpData::escape(row[4], row_sizes[4]);
118+ else
119+ table->comment= "";
120+
121 table->database= this;
122 if ((not table->populateFields()) or (not table->populateIndexes()))
123 {

Subscribers

People subscribed via source and target branches