Merge lp:~linuxjedi/drizzle/trunk-bug-663812 into lp:~drizzle-trunk/drizzle/development

Proposed by Andrew Hutchings
Status: Merged
Approved by: Brian Aker
Approved revision: 1863
Merged at revision: 1865
Proposed branch: lp:~linuxjedi/drizzle/trunk-bug-663812
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 62 lines (+21/-7)
2 files modified
client/drizzledump_data.cc (+11/-4)
client/drizzledump_mysql.cc (+10/-3)
To merge this branch: bzr merge lp:~linuxjedi/drizzle/trunk-bug-663812
Reviewer Review Type Date Requested Status
Drizzle Merge Team Pending
Review via email: mp+38930@code.launchpad.net

Description of the change

Drizzledump migration fixes:

* Link up --destination-database
* Fix retrieving precision/scale for DOUBLE from MySQL when it hasn't been hard set.

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-16 20:13:23 +0000
3+++ client/drizzledump_data.cc 2010-10-20 13:05:17 +0000
4@@ -43,6 +43,7 @@
5 extern bool opt_drop_database;
6 extern bool opt_autocommit;
7 extern bool ignore_errors;
8+extern std::string opt_destination_database;
9
10 extern boost::unordered_set<std::string> ignore_table;
11 extern void maybe_exit(int error);
12@@ -192,16 +193,22 @@
13 if (not opt_create_db)
14 {
15 if (opt_drop_database)
16- os << "DROP DATABASE IF EXISTS `" << obj.databaseName << "`" << std::endl;
17+ {
18+ os << "DROP DATABASE IF EXISTS `"
19+ << ((opt_destination_database.empty()) ? obj.databaseName
20+ : opt_destination_database) << "`" << std::endl;
21+ }
22
23- os << "CREATE DATABASE IF NOT EXISTS `" << obj.databaseName << "`";
24+ os << "CREATE DATABASE IF NOT EXISTS `"
25+ << ((opt_destination_database.empty()) ? obj.databaseName
26+ : opt_destination_database) << "`";
27 if (not obj.collate.empty())
28 os << " COLLATE = " << obj.collate;
29
30 os << ";" << std::endl << std::endl;
31 }
32-
33- os << "USE `" << obj.databaseName << "`;" << std::endl << std::endl;
34+ os << "USE `" << ((opt_destination_database.empty()) ? obj.databaseName
35+ : opt_destination_database) << "`;" << std::endl << std::endl;
36 }
37
38 std::vector<DrizzleDumpTable*>::iterator i;
39
40=== modified file 'client/drizzledump_mysql.cc'
41--- client/drizzledump_mysql.cc 2010-10-12 19:26:10 +0000
42+++ client/drizzledump_mysql.cc 2010-10-20 13:05:17 +0000
43@@ -203,9 +203,16 @@
44 field->isAutoIncrement= (strcmp(row[8], "auto_increment") == 0) ? true : false;
45 field->defaultIsNull= field->isNull;
46 field->length= (row[4]) ? boost::lexical_cast<uint32_t>(row[4]) : 0;
47- field->decimalPrecision= (row[5]) ? boost::lexical_cast<uint32_t>(row[5]) : 0;
48- field->decimalScale= (row[6]) ? boost::lexical_cast<uint32_t>(row[6]) : 0;
49-
50+ if ((row[5] != NULL) and (row[6] != NULL))
51+ {
52+ field->decimalPrecision= boost::lexical_cast<uint32_t>(row[5]);
53+ field->decimalScale= boost::lexical_cast<uint32_t>(row[6]);
54+ }
55+ else
56+ {
57+ field->decimalPrecision= 0;
58+ field->decimalScale= 0;
59+ }
60
61 fields.push_back(field);
62 }