Merge lp:~linuxjedi/drizzle/drizzle-bug-649844 into lp:drizzle/7.0
- drizzle-bug-649844
- Merge into 7.0
Proposed by
Andrew Hutchings
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Brian Aker | ||||
Approved revision: | 1805 | ||||
Merge reported by: | Lee Bieber | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~linuxjedi/drizzle/drizzle-bug-649844 | ||||
Merge into: | lp:drizzle/7.0 | ||||
Diff against target: |
674 lines (+116/-143) 8 files modified
client/drizzledump.cc (+23/-86) client/drizzledump_data.cc (+20/-3) client/drizzledump_drizzle.cc (+14/-4) client/drizzledump_mysql.cc (+14/-4) docs/clients/drizzledump.rst (+25/-22) tests/r/drizzledump.result (+16/-18) tests/t/drizzledump-max.test (+2/-2) tests/t/drizzledump.test (+2/-4) |
||||
To merge this branch: | bzr merge lp:~linuxjedi/drizzle/drizzle-bug-649844 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Merge Team | Pending | ||
Review via email: mp+37159@code.launchpad.net |
Commit message
Description of the change
Clean up and fix some drizzledump options along with some documentation fixes
To post a comment you must log in.
- 1806. By Andrew Hutchings
-
Accidentally duplicated skip-create which cause build faiure in some platforms
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'client/drizzledump.cc' |
2 | --- client/drizzledump.cc 2010-09-26 08:33:47 +0000 |
3 | +++ client/drizzledump.cc 2010-10-02 06:47:41 +0000 |
4 | @@ -80,28 +80,20 @@ |
5 | |
6 | bool verbose= false; |
7 | static bool use_drizzle_protocol= false; |
8 | -static bool quick= true; |
9 | -static bool ignore_errors= false; |
10 | -static bool flush_logs= false; |
11 | -static bool opt_keywords= false; |
12 | -static bool opt_compress= false; |
13 | -static bool opt_delayed= false; |
14 | +bool ignore_errors= false; |
15 | +bool opt_compress= false; |
16 | static bool create_options= true; |
17 | static bool opt_quoted= false; |
18 | bool opt_databases= false; |
19 | bool opt_alldbs= false; |
20 | static bool opt_lock_all_tables= false; |
21 | -static bool opt_set_charset= false; |
22 | static bool opt_dump_date= true; |
23 | -static bool opt_autocommit= false; |
24 | +bool opt_autocommit= false; |
25 | static bool opt_single_transaction= false; |
26 | static bool opt_comments; |
27 | static bool opt_compact; |
28 | -static bool opt_order_by_primary=false; |
29 | bool opt_ignore= false; |
30 | -static bool opt_complete_insert= false; |
31 | -static bool opt_drop_database; |
32 | -static bool opt_alltspcs= false; |
33 | +bool opt_drop_database; |
34 | bool opt_no_create_info; |
35 | bool opt_no_data= false; |
36 | bool opt_create_db= false; |
37 | @@ -110,9 +102,7 @@ |
38 | bool opt_replace_into= false; |
39 | bool opt_drop= true; |
40 | uint32_t show_progress_size= 0; |
41 | -//static uint64_t total_rows= 0; |
42 | static string insert_pat; |
43 | -//static char *order_by= NULL; |
44 | static uint32_t opt_drizzle_port= 0; |
45 | static int first_error= 0; |
46 | static string extended_row; |
47 | @@ -141,10 +131,7 @@ |
48 | enclosed, |
49 | escaped, |
50 | current_host, |
51 | - opt_enclosed, |
52 | - fields_terminated, |
53 | path, |
54 | - lines_terminated, |
55 | current_user, |
56 | opt_password, |
57 | opt_protocol, |
58 | @@ -170,7 +157,7 @@ |
59 | std::vector<DrizzleDumpDatabase*>::iterator i; |
60 | for (i= database_store.begin(); i != database_store.end(); ++i) |
61 | { |
62 | - if (not (*i)->populateTables()) |
63 | + if ((not (*i)->populateTables()) && (not ignore_errors)) |
64 | maybe_exit(EX_DRIZZLEERR); |
65 | } |
66 | } |
67 | @@ -178,14 +165,16 @@ |
68 | void generate_dump(void) |
69 | { |
70 | std::vector<DrizzleDumpDatabase*>::iterator i; |
71 | - if (opt_set_charset) |
72 | - cout << endl << "SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION;" << endl; |
73 | |
74 | if (path.empty()) |
75 | { |
76 | cout << endl << "SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;" |
77 | << endl << "SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;" << endl; |
78 | } |
79 | + |
80 | + if (opt_autocommit) |
81 | + cout << "SET AUTOCOMMIT=0;" << endl; |
82 | + |
83 | for (i= database_store.begin(); i != database_store.end(); ++i) |
84 | { |
85 | DrizzleDumpDatabase *database= *i; |
86 | @@ -197,8 +186,6 @@ |
87 | cout << "SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;" |
88 | << endl << "SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;" << endl; |
89 | } |
90 | - if (opt_set_charset) |
91 | - cout << "SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION;" << endl; |
92 | } |
93 | |
94 | void generate_dump_db(void) |
95 | @@ -210,8 +197,6 @@ |
96 | false); |
97 | sbuf.setConnection(destination_connection); |
98 | std::ostream sout(&sbuf); |
99 | - if (opt_set_charset) |
100 | - sout << "SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION;" << endl; |
101 | |
102 | if (path.empty()) |
103 | { |
104 | @@ -219,6 +204,9 @@ |
105 | sout << "SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;" << endl; |
106 | } |
107 | |
108 | + if (opt_autocommit) |
109 | + cout << "SET AUTOCOMMIT=0;" << endl; |
110 | + |
111 | for (i= database_store.begin(); i != database_store.end(); ++i) |
112 | { |
113 | DrizzleDumpDatabase *database= *i; |
114 | @@ -230,8 +218,6 @@ |
115 | sout << "SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;" << endl; |
116 | sout << "SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;" << endl; |
117 | } |
118 | - if (opt_set_charset) |
119 | - sout << "SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION;" << endl; |
120 | } |
121 | |
122 | /* |
123 | @@ -288,26 +274,12 @@ |
124 | |
125 | static int get_options(void) |
126 | { |
127 | - |
128 | - if (path.empty() && (! enclosed.empty() || ! opt_enclosed.empty() || ! escaped.empty() || ! lines_terminated.empty() || |
129 | - ! fields_terminated.empty())) |
130 | - { |
131 | - fprintf(stderr, |
132 | - _("%s: You must use option --tab with --fields-...\n"), progname.c_str()); |
133 | - return(EX_USAGE); |
134 | - } |
135 | - |
136 | if (opt_single_transaction && opt_lock_all_tables) |
137 | { |
138 | fprintf(stderr, _("%s: You can't use --single-transaction and " |
139 | "--lock-all-tables at the same time.\n"), progname.c_str()); |
140 | return(EX_USAGE); |
141 | } |
142 | - if (! enclosed.empty() && ! opt_enclosed.empty()) |
143 | - { |
144 | - fprintf(stderr, _("%s: You can't use ..enclosed.. and ..optionally-enclosed.. at the same time.\n"), progname.c_str()); |
145 | - return(EX_USAGE); |
146 | - } |
147 | if ((opt_databases || opt_alldbs) && ! path.empty()) |
148 | { |
149 | fprintf(stderr, |
150 | @@ -436,7 +408,8 @@ |
151 | if (not database->populateTables(table_names)) |
152 | { |
153 | delete database; |
154 | - maybe_exit(EX_DRIZZLEERR); |
155 | + if (not ignore_errors) |
156 | + maybe_exit(EX_DRIZZLEERR); |
157 | } |
158 | |
159 | database_store.push_back(database); |
160 | @@ -484,26 +457,17 @@ |
161 | commandline_options.add_options() |
162 | ("all-databases,A", po::value<bool>(&opt_alldbs)->default_value(false)->zero_tokens(), |
163 | N_("Dump all the databases. This will be same as --databases with all databases selected.")) |
164 | - ("all-tablespaces,Y", po::value<bool>(&opt_alltspcs)->default_value(false)->zero_tokens(), |
165 | - N_("Dump all the tablespaces.")) |
166 | - ("complete-insert,c", po::value<bool>(&opt_complete_insert)->default_value(false)->zero_tokens(), |
167 | - N_("Use complete insert statements.")) |
168 | ("compress,C", po::value<bool>(&opt_compress)->default_value(false)->zero_tokens(), |
169 | N_("Use compression in server/client protocol.")) |
170 | - ("flush-logs,F", po::value<bool>(&flush_logs)->default_value(false)->zero_tokens(), |
171 | - N_("Flush logs file in server before starting dump. Note that if you dump many databases at once (using the option --databases= or --all-databases), the logs will be flushed for each database dumped. The exception is when using --lock-all-tables in this case the logs will be flushed only once, corresponding to the moment all tables are locked. So if you want your dump and the log flush to happen at the same exact moment you should use --lock-all-tables or --flush-logs")) |
172 | ("force,f", po::value<bool>(&ignore_errors)->default_value(false)->zero_tokens(), |
173 | N_("Continue even if we get an sql-error.")) |
174 | ("help,?", N_("Display this help message and exit.")) |
175 | ("lock-all-tables,x", po::value<bool>(&opt_lock_all_tables)->default_value(false)->zero_tokens(), |
176 | - N_("Locks all tables across all databases. This is achieved by taking a global read lock for the duration of the whole dump. Automatically turns --single-transaction and --lock-tables off.")) |
177 | - ("order-by-primary", po::value<bool>(&opt_order_by_primary)->default_value(false)->zero_tokens(), |
178 | - N_("Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.")) |
179 | + N_("Locks all tables across all databases. This is achieved by taking a global read lock for the duration of the whole dump. Automatically turns --single-transaction off.")) |
180 | ("single-transaction", po::value<bool>(&opt_single_transaction)->default_value(false)->zero_tokens(), |
181 | - N_("Creates a consistent snapshot by dumping all tables in a single transaction. Works ONLY for tables stored in storage engines which support multiversioning (currently only InnoDB does); the dump is NOT guaranteed to be consistent for other storage engines. While a --single-transaction dump is in process, to ensure a valid dump file (correct table contents), no other connection should use the following statements: ALTER TABLE, DROP TABLE, RENAME TABLE, TRUNCATE TABLE, as consistent snapshot is not isolated from them. Option automatically turns off --lock-tables.")) |
182 | - ("opt", N_("Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt.")) |
183 | + N_("Creates a consistent snapshot by dumping all tables in a single transaction. Works ONLY for tables stored in storage engines which support multiversioning (currently only InnoDB does); the dump is NOT guaranteed to be consistent for other storage engines. While a --single-transaction dump is in process, to ensure a valid dump file (correct table contents), no other connection should use the following statements: ALTER TABLE, DROP TABLE, RENAME TABLE, TRUNCATE TABLE, as consistent snapshot is not isolated from them.")) |
184 | ("skip-opt", |
185 | - N_("Disable --opt. Disables --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys.")) |
186 | + N_("Disable --opt. Disables --add-drop-table, --add-locks, --create-options, ---extended-insert and --disable-keys.")) |
187 | ("tables", N_("Overrides option --databases (-B).")) |
188 | ("show-progress-size", po::value<uint32_t>(&show_progress_size)->default_value(10000), |
189 | N_("Number of rows before each output progress report (requires --verbose).")) |
190 | @@ -522,38 +486,24 @@ |
191 | ("add-drop-database", po::value<bool>(&opt_drop_database)->default_value(false)->zero_tokens(), |
192 | N_("Add a 'DROP DATABASE' before each create.")) |
193 | ("skip-drop-table", N_("Do not add a 'drop table' before each create.")) |
194 | - ("allow-keywords", po::value<bool>(&opt_keywords)->default_value(false)->zero_tokens(), |
195 | - N_("Allow creation of column names that are keywords.")) |
196 | ("compact", po::value<bool>(&opt_compact)->default_value(false)->zero_tokens(), |
197 | - N_("Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options --skip-add-drop-table --no-set-names --skip-disable-keys --skip-add-locks")) |
198 | + N_("Give less verbose output (useful for debugging). Disables structure comments and header/footer constructs. Enables options --skip-add-drop-table --no-set-names --skip-disable-keys")) |
199 | ("databases,B", po::value<bool>(&opt_databases)->default_value(false)->zero_tokens(), |
200 | N_("To dump several databases. Note the difference in usage; In this case no tables are given. All name arguments are regarded as databasenames. 'USE db_name;' will be included in the output.")) |
201 | - ("delayed-insert", po::value<bool>(&opt_delayed)->default_value(false)->zero_tokens(), |
202 | - N_("Insert rows with INSERT DELAYED;")) |
203 | ("skip-disable-keys,K", |
204 | N_("'ALTER TABLE tb_name DISABLE KEYS; and 'ALTER TABLE tb_name ENABLE KEYS; will not be put in the output.")) |
205 | ("ignore-table", po::value<string>(), |
206 | N_("Do not dump the specified table. To specify more than one table to ignore, use the directive multiple times, once for each table. Each table must be specified with both database and table names, e.g. --ignore-table=database.table")) |
207 | ("insert-ignore", po::value<bool>(&opt_ignore)->default_value(false)->zero_tokens(), |
208 | N_("Insert rows with INSERT IGNORE.")) |
209 | - ("lines-terminated-by", po::value<string>(&lines_terminated)->default_value(""), |
210 | - N_("Lines in the i.file are terminated by ...")) |
211 | ("no-autocommit", po::value<bool>(&opt_autocommit)->default_value(false)->zero_tokens(), |
212 | - N_("Wrap tables with autocommit/commit statements.")) |
213 | + N_("Wrap a table's data in START TRANSACTION/COMMIT statements.")) |
214 | ("no-create-db,n", po::value<bool>(&opt_create_db)->default_value(false)->zero_tokens(), |
215 | N_("'CREATE DATABASE IF NOT EXISTS db_name;' will not be put in the output. The above line will be added otherwise, if --databases or --all-databases option was given.")) |
216 | - ("no-create-info,t", po::value<bool>(&opt_no_create_info)->default_value(false)->zero_tokens(), |
217 | - N_("Don't write table creation info.")) |
218 | ("no-data,d", po::value<bool>(&opt_no_data)->default_value(false)->zero_tokens(), |
219 | N_("No row information.")) |
220 | - ("no-set-names,N", N_("Deprecated. Use --skip-set-charset instead.")) |
221 | - ("set-charset", po::value<bool>(&opt_set_charset)->default_value(false)->zero_tokens(), |
222 | - N_("Enable set-name")) |
223 | - ("slow", N_("Buffer query instead of dumping directly to stdout.")) |
224 | ("replace", po::value<bool>(&opt_replace_into)->default_value(false)->zero_tokens(), |
225 | N_("Use REPLACE INTO instead of INSERT INTO.")) |
226 | - ("result-file,r", po::value<string>(), |
227 | - N_("Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).")) |
228 | ("destination-type", po::value<string>()->default_value("stdout"), |
229 | N_("Where to send output to (stdout|database")) |
230 | ("destination-host", po::value<string>(&opt_destination_host)->default_value("localhost"), |
231 | @@ -669,7 +619,6 @@ |
232 | extended_insert= (vm.count("skip-extended-insert")) ? false : true; |
233 | opt_dump_date= (vm.count("skip-dump-date")) ? false : true; |
234 | opt_disable_keys= (vm.count("skip-disable-keys")) ? false : true; |
235 | - quick= (vm.count("slow")) ? false : true; |
236 | opt_quoted= (vm.count("skip-quote-names")) ? false : true; |
237 | |
238 | if (vm.count("protocol")) |
239 | @@ -720,17 +669,6 @@ |
240 | tty_password= true; |
241 | } |
242 | |
243 | - if (vm.count("result-file")) |
244 | - { |
245 | - if (!(md_result_file= fopen(vm["result-file"].as<string>().c_str(), "w"))) |
246 | - exit(1); |
247 | - } |
248 | - |
249 | - if (vm.count("no-set-names")) |
250 | - { |
251 | - opt_set_charset= 0; |
252 | - } |
253 | - |
254 | if (! path.empty()) |
255 | { |
256 | opt_disable_keys= 0; |
257 | @@ -738,20 +676,19 @@ |
258 | |
259 | if (vm.count("skip-opt")) |
260 | { |
261 | - extended_insert= opt_drop= quick= create_options= 0; |
262 | - opt_disable_keys= opt_set_charset= 0; |
263 | + extended_insert= opt_drop= create_options= 0; |
264 | + opt_disable_keys= 0; |
265 | } |
266 | |
267 | if (opt_compact) |
268 | { |
269 | opt_comments= opt_drop= opt_disable_keys= 0; |
270 | - opt_set_charset= 0; |
271 | } |
272 | |
273 | if (vm.count("opt")) |
274 | { |
275 | - extended_insert= opt_drop= quick= create_options= 1; |
276 | - opt_disable_keys= opt_set_charset= 1; |
277 | + extended_insert= opt_drop= create_options= 1; |
278 | + opt_disable_keys= 1; |
279 | } |
280 | |
281 | if (vm.count("tables")) |
282 | |
283 | === modified file 'client/drizzledump_data.cc' |
284 | --- client/drizzledump_data.cc 2010-09-24 14:56:23 +0000 |
285 | +++ client/drizzledump_data.cc 2010-10-02 06:47:41 +0000 |
286 | @@ -39,6 +39,10 @@ |
287 | extern bool opt_alldbs; |
288 | extern uint32_t show_progress_size; |
289 | extern bool opt_ignore; |
290 | +extern bool opt_compress; |
291 | +extern bool opt_drop_database; |
292 | +extern bool opt_autocommit; |
293 | +extern bool ignore_errors; |
294 | |
295 | extern boost::unordered_set<std::string> ignore_table; |
296 | extern void maybe_exit(int error); |
297 | @@ -170,6 +174,9 @@ |
298 | /* Love that this variable is the opposite of its name */ |
299 | if (not opt_create_db) |
300 | { |
301 | + if (opt_drop_database) |
302 | + os << "DROP DATABASE IF EXISTS `" << obj.databaseName << "`" << std::endl; |
303 | + |
304 | os << "CREATE DATABASE IF NOT EXISTS `" << obj.databaseName << "`"; |
305 | if (not obj.collate.empty()) |
306 | os << " COLLATE = " << obj.collate; |
307 | @@ -194,7 +201,10 @@ |
308 | if (data == NULL) |
309 | { |
310 | std::cerr << "Error: Could not get data for table " << table->displayName << std::endl; |
311 | - maybe_exit(EX_DRIZZLEERR); |
312 | + if (not ignore_errors) |
313 | + maybe_exit(EX_DRIZZLEERR); |
314 | + else |
315 | + continue; |
316 | } |
317 | os << *data; |
318 | delete data; |
319 | @@ -235,6 +245,10 @@ |
320 | if (opt_disable_keys) |
321 | os << "ALTER TABLE `" << obj.table->displayName << "` DISABLE KEYS;" << std::endl; |
322 | |
323 | + /* Another option that does the opposite of its name, makes me sad :( */ |
324 | + if (opt_autocommit) |
325 | + os << "START TRANSACTION;" << std::endl; |
326 | + |
327 | std::streampos out_position= os.tellp(); |
328 | |
329 | while((row= drizzle_row_next(obj.result))) |
330 | @@ -309,6 +323,9 @@ |
331 | } |
332 | os << ");" << std::endl; |
333 | |
334 | + if (opt_autocommit) |
335 | + os << "COMMIT;" << std::endl; |
336 | + |
337 | if (opt_disable_keys) |
338 | os << "ALTER TABLE `" << obj.table->tableName << "` ENABLE KEYS;" << std::endl; |
339 | |
340 | @@ -531,8 +548,8 @@ |
341 | return true; |
342 | } |
343 | |
344 | -void DrizzleDumpConnection::errorHandler(drizzle_result_st *res, drizzle_return_t ret, |
345 | - const char *when) |
346 | +void DrizzleDumpConnection::errorHandler(drizzle_result_st *res, |
347 | + drizzle_return_t ret, const char *when) |
348 | { |
349 | if (ret == DRIZZLE_RETURN_ERROR_CODE) |
350 | { |
351 | |
352 | === modified file 'client/drizzledump_drizzle.cc' |
353 | --- client/drizzledump_drizzle.cc 2010-09-24 16:02:02 +0000 |
354 | +++ client/drizzledump_drizzle.cc 2010-10-02 06:47:41 +0000 |
355 | @@ -25,7 +25,8 @@ |
356 | #include <drizzled/gettext.h> |
357 | #include <boost/lexical_cast.hpp> |
358 | |
359 | -extern bool verbose; |
360 | +extern bool verbose; |
361 | +extern bool ignore_errors; |
362 | |
363 | bool DrizzleDumpDatabaseDrizzle::populateTables() |
364 | { |
365 | @@ -65,7 +66,10 @@ |
366 | if ((not table->populateFields()) or (not table->populateIndexes())) |
367 | { |
368 | delete table; |
369 | - return false; |
370 | + if (not ignore_errors) |
371 | + return false; |
372 | + else |
373 | + continue; |
374 | } |
375 | tables.push_back(table); |
376 | } |
377 | @@ -121,7 +125,10 @@ |
378 | std::cerr << "Error: Could not get fields and/ot indexes for table " << displayName << std::endl; |
379 | delete table; |
380 | dcon->freeResult(result); |
381 | - return false; |
382 | + if (not ignore_errors) |
383 | + return false; |
384 | + else |
385 | + continue; |
386 | } |
387 | tables.push_back(table); |
388 | dcon->freeResult(result); |
389 | @@ -130,7 +137,10 @@ |
390 | { |
391 | std::cerr << "Error: Table " << displayName << " not found." << std::endl; |
392 | dcon->freeResult(result); |
393 | - return false; |
394 | + if (not ignore_errors) |
395 | + return false; |
396 | + else |
397 | + continue; |
398 | } |
399 | } |
400 | |
401 | |
402 | === modified file 'client/drizzledump_mysql.cc' |
403 | --- client/drizzledump_mysql.cc 2010-09-24 13:38:21 +0000 |
404 | +++ client/drizzledump_mysql.cc 2010-10-02 06:47:41 +0000 |
405 | @@ -26,7 +26,8 @@ |
406 | #include <boost/date_time/posix_time/posix_time.hpp> |
407 | #include <drizzled/gettext.h> |
408 | |
409 | -extern bool verbose; |
410 | +extern bool verbose; |
411 | +extern bool ignore_errors; |
412 | |
413 | bool DrizzleDumpDatabaseMySQL::populateTables() |
414 | { |
415 | @@ -70,7 +71,10 @@ |
416 | if ((not table->populateFields()) or (not table->populateIndexes())) |
417 | { |
418 | delete table; |
419 | - return false; |
420 | + if (not ignore_errors) |
421 | + return false; |
422 | + else |
423 | + continue; |
424 | } |
425 | tables.push_back(table); |
426 | } |
427 | @@ -125,7 +129,10 @@ |
428 | if ((not table->populateFields()) or (not table->populateIndexes())) |
429 | { |
430 | delete table; |
431 | - return false; |
432 | + if (not ignore_errors) |
433 | + return false; |
434 | + else |
435 | + continue; |
436 | } |
437 | tables.push_back(table); |
438 | dcon->freeResult(result); |
439 | @@ -133,7 +140,10 @@ |
440 | else |
441 | { |
442 | dcon->freeResult(result); |
443 | - return false; |
444 | + if (not ignore_errors) |
445 | + return false; |
446 | + else |
447 | + continue; |
448 | } |
449 | } |
450 | |
451 | |
452 | === modified file 'docs/clients/drizzledump.rst' |
453 | --- docs/clients/drizzledump.rst 2010-09-28 17:34:48 +0000 |
454 | +++ docs/clients/drizzledump.rst 2010-10-02 06:47:41 +0000 |
455 | @@ -35,21 +35,15 @@ |
456 | *data_dictionary* in Drizzle and *information_schema*, *performance_schema* |
457 | and *mysql* in MySQL. |
458 | |
459 | -.. option:: -c, --complete-insert |
460 | - |
461 | - Dumps using complete insert statements. *CURRENTLY BROKEN* |
462 | - |
463 | .. option:: -C, --compress |
464 | |
465 | Use client/server compression protocol. |
466 | |
467 | -.. option:: -F, --flush-logs |
468 | - |
469 | - Flush the server logs before commencing with the dump. *CURRENTLY_BROKEN* |
470 | + **NOTE:** this option is not currently implemented. |
471 | |
472 | .. option:: -f, --force |
473 | |
474 | - Continue even if we get an sql-error. *CURRENTLY_BROKEN* |
475 | + Continue even if we get an sql-error. |
476 | |
477 | .. option:: -?, --help |
478 | |
479 | @@ -73,13 +67,12 @@ |
480 | RENAME TABLE |
481 | TRUNCATE TABLE |
482 | |
483 | - Only works with InnoDB. Automatically disables :option:`--lock-tables`. |
484 | - |
485 | -.. option:: --disable-opt |
486 | - |
487 | - A shortcut for :option:`--skip-drop-table`, :option:`--skip-locks`, |
488 | - :option:`--skip-create`, :option:`--slow`, :option:`--skip-extended-insert` |
489 | - and :option:`--skip-disable-keys` |
490 | + Only works with InnoDB. |
491 | + |
492 | +.. option:: --skip-opt |
493 | + |
494 | + A shortcut for :option:`--skip-drop-table`, :option:`--skip-create`, |
495 | + :option:`--skip-extended-insert` and :option:`--skip-disable-keys` |
496 | |
497 | .. option:: --tables t1 t2 ... |
498 | |
499 | @@ -120,14 +113,24 @@ |
500 | .. option:: --compact |
501 | |
502 | Gives a more compact output by disabling header/footer comments and enabling |
503 | - :option:`--skip-add-drop-table`, :option:`--no-set-names`, |
504 | - :option:`--skip-disable-keys` and :option:`--skip-add-locks`. |
505 | + :option:`--skip-add-drop-table`, :option:`--skip-disable-keys` |
506 | + and :option:`--skip-add-locks`. |
507 | |
508 | .. option:: -B, --databases |
509 | |
510 | Dump several databases. The databases do not need to follow on after this |
511 | option, they can be anywhere in the command line. |
512 | |
513 | +.. option:: -K, --skip-disable-keys |
514 | + |
515 | + Do not dump the statements `ALTER TABLE ... DISABLE KEYS` and |
516 | + `ALTER TABLE ... ENABLE KEYS` |
517 | + |
518 | +.. option:: --ignore-table table |
519 | + |
520 | + Do not dump specified table, needs to be in the format `database.table`. |
521 | + Can be specified multiple times for multiple tables. |
522 | + |
523 | .. option:: --insert-ignore |
524 | |
525 | Add the `IGNORE` keyword into every `INSERT` statement. |
526 | @@ -139,17 +142,17 @@ |
527 | |
528 | .. option:: -n, --no-create-db |
529 | |
530 | - Do not output the `CREATE DATABASE` statements when using |
531 | + Do not dump the `CREATE DATABASE` statements when using |
532 | :option:`--all-databases` or :option:`--databases`. |
533 | |
534 | +.. option:: -t, --skip-create |
535 | + |
536 | + Do not dump the `CREATE TABLE` statements. |
537 | + |
538 | .. option:: -d, --no-data |
539 | |
540 | Do not dump the data itself, used to dump the schemas only. |
541 | |
542 | -.. option:: --slow |
543 | - |
544 | - Dump directly from database to destination rather than using a query buffer. |
545 | - |
546 | .. option:: --replace |
547 | |
548 | Use `REPLACE INTO` statements instead of `INSERT INTO` |
549 | |
550 | === modified file 'tests/r/drizzledump.result' |
551 | --- tests/r/drizzledump.result 2010-09-24 15:43:43 +0000 |
552 | +++ tests/r/drizzledump.result 2010-10-02 06:47:41 +0000 |
553 | @@ -126,20 +126,6 @@ |
554 | |
555 | SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; |
556 | SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; |
557 | - |
558 | -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; |
559 | -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; |
560 | -DROP TABLE IF EXISTS `t1`; |
561 | -CREATE TABLE `t1` ( |
562 | - `a` INT DEFAULT NULL |
563 | -) ENGINE=InnoDB COLLATE = utf8_general_ci; |
564 | - |
565 | -ALTER TABLE `t1` DISABLE KEYS; |
566 | -INSERT IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6); |
567 | -ALTER TABLE `t1` ENABLE KEYS; |
568 | - |
569 | -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; |
570 | -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; |
571 | DROP TABLE t1; |
572 | # |
573 | # Bug #10286: mysqldump -c crashes on table that has many fields with long |
574 | @@ -829,6 +815,7 @@ |
575 | |
576 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; |
577 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; |
578 | +DROP DATABASE IF EXISTS `test` |
579 | CREATE DATABASE IF NOT EXISTS `test`; |
580 | |
581 | USE `test`; |
582 | @@ -987,6 +974,21 @@ |
583 | |
584 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; |
585 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; |
586 | +DROP TABLE IF EXISTS `t3`; |
587 | +CREATE TABLE `t3` ( |
588 | + `a` INT DEFAULT NULL |
589 | +) ENGINE=InnoDB COLLATE = utf8_general_ci; |
590 | + |
591 | +DROP TABLE IF EXISTS `t1`; |
592 | +CREATE TABLE `t1` ( |
593 | + `a` INT DEFAULT NULL |
594 | +) ENGINE=InnoDB COLLATE = utf8_general_ci; |
595 | + |
596 | +DROP TABLE IF EXISTS `t2`; |
597 | +CREATE TABLE `t2` ( |
598 | + `a` INT DEFAULT NULL |
599 | +) ENGINE=InnoDB COLLATE = utf8_general_ci; |
600 | + |
601 | SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; |
602 | SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; |
603 | drop table t1, t2, t3; |
604 | @@ -1068,18 +1070,14 @@ |
605 | use `test-database`; |
606 | create table test (a int); |
607 | |
608 | -SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION; |
609 | - |
610 | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; |
611 | SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; |
612 | -DROP TABLE IF EXISTS `test`; |
613 | CREATE TABLE `test` ( |
614 | `a` INT DEFAULT NULL |
615 | ) ENGINE=InnoDB COLLATE = utf8_general_ci; |
616 | |
617 | SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; |
618 | SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; |
619 | -SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION; |
620 | drop database `test-database`; |
621 | use test; |
622 | CREATE DATABASE mysqldump_30126; |
623 | |
624 | === modified file 'tests/t/drizzledump-max.test' |
625 | --- tests/t/drizzledump-max.test 2010-07-02 15:58:00 +0000 |
626 | +++ tests/t/drizzledump-max.test 2010-10-02 06:47:41 +0000 |
627 | @@ -55,8 +55,8 @@ |
628 | #select * from t5; |
629 | select * from t6; |
630 | |
631 | ---exec $DRIZZLE_DUMP --skip-comments --delayed-insert --insert-ignore --databases test |
632 | ---exec $DRIZZLE_DUMP --skip-comments --delayed-insert --databases test |
633 | +--exec $DRIZZLE_DUMP --skip-comments --insert-ignore --databases test |
634 | +--exec $DRIZZLE_DUMP --skip-comments --databases test |
635 | |
636 | drop table t1; |
637 | drop table t2; |
638 | |
639 | === modified file 'tests/t/drizzledump.test' |
640 | --- tests/t/drizzledump.test 2010-09-24 13:38:21 +0000 |
641 | +++ tests/t/drizzledump.test 2010-10-02 06:47:41 +0000 |
642 | @@ -74,7 +74,6 @@ |
643 | INSERT INTO t1 VALUES (1),(2),(3); |
644 | INSERT INTO t1 VALUES (4),(5),(6); |
645 | --exec $DRIZZLE_DUMP --skip-comments --insert-ignore test t1 |
646 | ---exec $DRIZZLE_DUMP --skip-comments --insert-ignore --delayed-insert test t1 |
647 | DROP TABLE t1; |
648 | |
649 | --echo # |
650 | @@ -413,7 +412,7 @@ |
651 | F_6faa8040da20ef399b63a72d0e4ab575 int, |
652 | F_fe73f687e5bc5280214e0486b273a5f9 int); |
653 | insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1); |
654 | ---exec $DRIZZLE_DUMP --skip-comments -c test |
655 | +--exec $DRIZZLE_DUMP --skip-comments test |
656 | drop table t1; |
657 | |
658 | --echo # |
659 | @@ -541,7 +540,6 @@ |
660 | create table t1(a int); |
661 | create table t2(a int); |
662 | create table t3(a int); |
663 | ---error 2 |
664 | --exec $DRIZZLE_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2 |
665 | drop table t1, t2, t3; |
666 | |
667 | @@ -652,7 +650,7 @@ |
668 | create database `test-database`; |
669 | use `test-database`; |
670 | create table test (a int); |
671 | ---exec $DRIZZLE_DUMP --compact --opt test-database |
672 | +--exec $DRIZZLE_DUMP --compact test-database |
673 | drop database `test-database`; |
674 | use test; |
675 |