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
=== modified file 'client/drizzledump_data.cc'
--- client/drizzledump_data.cc 2010-10-02 14:41:31 +0000
+++ client/drizzledump_data.cc 2010-10-04 15:27:46 +0000
@@ -306,7 +306,7 @@
306 (obj.table->fields[i]->type.compare("VARBINARY") == 0)))306 (obj.table->fields[i]->type.compare("VARBINARY") == 0)))
307 os << obj.convertHex((unsigned char*)row[i], row_sizes[i]);307 os << obj.convertHex((unsigned char*)row[i], row_sizes[i]);
308 else308 else
309 os << "'" << obj.escape(row[i], row_sizes[i]) << "'";309 os << "'" << DrizzleDumpData::escape(row[i], row_sizes[i]) << "'";
310 }310 }
311 else311 else
312 os << row[i];312 os << row[i];
@@ -353,7 +353,7 @@
353}353}
354354
355/* Ripped out of libdrizzle, hopefully a little safer */355/* Ripped out of libdrizzle, hopefully a little safer */
356std::string DrizzleDumpData::escape(const char* from, size_t from_size) const356std::string DrizzleDumpData::escape(const char* from, size_t from_size)
357{357{
358 std::string output;358 std::string output;
359359
@@ -421,7 +421,14 @@
421 os << "AUTO_INCREMENT=" << obj.autoIncrement << " ";421 os << "AUTO_INCREMENT=" << obj.autoIncrement << " ";
422 }422 }
423423
424 os << "COLLATE = " << obj.collate << ";" << std::endl << std::endl;424 os << "COLLATE = " << obj.collate;
425
426 if (not obj.comment.empty())
427 {
428 os << " COMMENT = '" << obj.comment << "'";
429 }
430
431 os << ";" << std::endl << std::endl;
425432
426 return os;433 return os;
427}434}
428435
=== modified file 'client/drizzledump_data.h'
--- client/drizzledump_data.h 2010-09-30 13:36:29 +0000
+++ client/drizzledump_data.h 2010-10-04 15:27:46 +0000
@@ -116,6 +116,7 @@
116 std::string displayName;116 std::string displayName;
117 std::string engineName;117 std::string engineName;
118 std::string collate;118 std::string collate;
119 std::string comment;
119120
120 // Currently MySQL only, hard to do in Drizzle121 // Currently MySQL only, hard to do in Drizzle
121 uint64_t autoIncrement;122 uint64_t autoIncrement;
@@ -165,7 +166,7 @@
165166
166 virtual std::ostream& checkDateTime(std::ostream &os, const char*, uint32_t) const { return os; }167 virtual std::ostream& checkDateTime(std::ostream &os, const char*, uint32_t) const { return os; }
167 std::string convertHex(const unsigned char* from, size_t from_size) const;168 std::string convertHex(const unsigned char* from, size_t from_size) const;
168 std::string escape(const char* from, size_t from_size) const;169 static std::string escape(const char* from, size_t from_size);
169};170};
170171
171class DrizzleDumpConnection172class DrizzleDumpConnection
172173
=== modified file 'client/drizzledump_drizzle.cc'
--- client/drizzledump_drizzle.cc 2010-10-02 14:37:55 +0000
+++ client/drizzledump_drizzle.cc 2010-10-04 15:27:46 +0000
@@ -40,7 +40,7 @@
40 if (verbose)40 if (verbose)
41 std::cerr << _("-- Retrieving table structures for ") << databaseName << "..." << std::endl;41 std::cerr << _("-- Retrieving table structures for ") << databaseName << "..." << std::endl;
4242
43 query="SELECT TABLE_NAME, TABLE_COLLATION, ENGINE, AUTO_INCREMENT FROM DATA_DICTIONARY.TABLES WHERE TABLE_SCHEMA='";43 query="SELECT TABLE_NAME, TABLE_COLLATION, ENGINE, AUTO_INCREMENT, TABLE_COMMENT FROM DATA_DICTIONARY.TABLES WHERE TABLE_SCHEMA='";
44 query.append(databaseName);44 query.append(databaseName);
45 query.append("' ORDER BY TABLE_NAME");45 query.append("' ORDER BY TABLE_NAME");
4646
@@ -51,6 +51,7 @@
5151
52 while ((row= drizzle_row_next(result)))52 while ((row= drizzle_row_next(result)))
53 {53 {
54 size_t* row_sizes= drizzle_row_field_sizes(result);
54 std::string tableName(row[0]);55 std::string tableName(row[0]);
55 std::string displayName(tableName);56 std::string displayName(tableName);
56 cleanTableName(displayName);57 cleanTableName(displayName);
@@ -62,6 +63,10 @@
62 table->collate= row[1];63 table->collate= row[1];
63 table->engineName= row[2];64 table->engineName= row[2];
64 table->autoIncrement= boost::lexical_cast<uint64_t>(row[3]);65 table->autoIncrement= boost::lexical_cast<uint64_t>(row[3]);
66 if (row[4])
67 table->comment= DrizzleDumpData::escape(row[4], row_sizes[4]);
68 else
69 table->comment= "";
65 table->database= this;70 table->database= this;
66 if ((not table->populateFields()) or (not table->populateIndexes()))71 if ((not table->populateFields()) or (not table->populateIndexes()))
67 {72 {
6873
=== modified file 'client/drizzledump_mysql.cc'
--- client/drizzledump_mysql.cc 2010-10-02 14:36:07 +0000
+++ client/drizzledump_mysql.cc 2010-10-04 15:27:46 +0000
@@ -41,7 +41,7 @@
41 if (verbose)41 if (verbose)
42 std::cerr << _("-- Retrieving table structures for ") << databaseName << "..." << std::endl;42 std::cerr << _("-- Retrieving table structures for ") << databaseName << "..." << std::endl;
4343
44 query="SELECT TABLE_NAME, TABLE_COLLATION, ENGINE, AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE != 'VIEW' AND TABLE_SCHEMA='";44 query="SELECT TABLE_NAME, TABLE_COLLATION, ENGINE, AUTO_INCREMENT, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE != 'VIEW' AND TABLE_SCHEMA='";
45 query.append(databaseName);45 query.append(databaseName);
46 query.append("' ORDER BY TABLE_NAME");46 query.append("' ORDER BY TABLE_NAME");
4747
@@ -52,6 +52,7 @@
5252
53 while ((row= drizzle_row_next(result)))53 while ((row= drizzle_row_next(result)))
54 {54 {
55 size_t* row_sizes= drizzle_row_field_sizes(result);
55 std::string tableName(row[0]);56 std::string tableName(row[0]);
56 std::string displayName(tableName);57 std::string displayName(tableName);
57 cleanTableName(displayName);58 cleanTableName(displayName);
@@ -67,6 +68,11 @@
67 else68 else
68 table->autoIncrement= 0;69 table->autoIncrement= 0;
6970
71 if (row[4])
72 table->comment= DrizzleDumpData::escape(row[4], row_sizes[4]);
73 else
74 table->comment= "";
75
70 table->database= this;76 table->database= this;
71 if ((not table->populateFields()) or (not table->populateIndexes()))77 if ((not table->populateFields()) or (not table->populateIndexes()))
72 {78 {

Subscribers

People subscribed via source and target branches