Merge lp:~jaypipes/drizzle/replication-raw-sql into lp:~drizzle-trunk/drizzle/development

Proposed by Jay Pipes
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jaypipes/drizzle/replication-raw-sql
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 3923 lines (+1753/-860)
56 files modified
drizzled/cursor.cc (+12/-0)
drizzled/db.cc (+2/-2)
drizzled/join.cc (+6/-0)
drizzled/message/statement_transform.cc (+803/-267)
drizzled/message/statement_transform.h (+161/-13)
drizzled/message/table.proto (+1/-1)
drizzled/message/table_reader.cc (+5/-242)
drizzled/message/transaction.proto (+1/-0)
drizzled/replication_services.cc (+124/-4)
drizzled/replication_services.h (+44/-3)
drizzled/sql_insert.cc (+7/-22)
drizzled/sql_table.cc (+15/-13)
drizzled/table_proto_write.cc (+7/-4)
drizzled/table_share.cc (+27/-0)
drizzled/table_share.h (+6/-0)
plugin/transaction_log/tests/r/alter.result (+3/-3)
plugin/transaction_log/tests/r/auto_commit.result (+23/-23)
plugin/transaction_log/tests/r/blob.result (+3/-3)
plugin/transaction_log/tests/r/create_schema.result (+13/-0)
plugin/transaction_log/tests/r/create_select.result (+18/-14)
plugin/transaction_log/tests/r/create_table.result (+54/-0)
plugin/transaction_log/tests/r/database.result (+1/-1)
plugin/transaction_log/tests/r/delete.result (+7/-7)
plugin/transaction_log/tests/r/filtered_replicator.result (+77/-79)
plugin/transaction_log/tests/r/insert.result (+2/-2)
plugin/transaction_log/tests/r/insert_multi.result (+2/-2)
plugin/transaction_log/tests/r/insert_on_duplicate_update.result (+3/-3)
plugin/transaction_log/tests/r/insert_select.result (+8/-8)
plugin/transaction_log/tests/r/multi_column_primary_key.result (+55/-0)
plugin/transaction_log/tests/r/no_modification.result (+2/-2)
plugin/transaction_log/tests/r/no_primary_key.result (+7/-7)
plugin/transaction_log/tests/r/rand.result (+3/-3)
plugin/transaction_log/tests/r/rename.result (+7/-7)
plugin/transaction_log/tests/r/replace.result (+16/-16)
plugin/transaction_log/tests/r/rollback.result (+7/-7)
plugin/transaction_log/tests/r/schema.result (+13/-0)
plugin/transaction_log/tests/r/select_for_update.result (+3/-3)
plugin/transaction_log/tests/r/temp_tables.result (+3/-3)
plugin/transaction_log/tests/r/truncate.result (+2/-2)
plugin/transaction_log/tests/r/truncate_log.result (+1/-1)
plugin/transaction_log/tests/r/update.result (+9/-9)
plugin/transaction_log/tests/t/create_table-master.opt (+1/-0)
plugin/transaction_log/tests/t/create_table.inc (+53/-0)
plugin/transaction_log/tests/t/create_table.test (+9/-0)
plugin/transaction_log/tests/t/database.inc (+0/-12)
plugin/transaction_log/tests/t/database.test (+0/-13)
plugin/transaction_log/tests/t/filtered_replicator.test (+1/-1)
plugin/transaction_log/tests/t/multi_column_primary_key-master.opt (+1/-0)
plugin/transaction_log/tests/t/multi_column_primary_key.inc (+36/-0)
plugin/transaction_log/tests/t/multi_column_primary_key.test (+9/-0)
plugin/transaction_log/tests/t/schema-master.opt (+1/-0)
plugin/transaction_log/tests/t/schema.inc (+12/-0)
plugin/transaction_log/tests/t/schema.test (+9/-0)
tests/r/innodb.result (+18/-18)
tests/r/mix2_myisam.result (+24/-24)
tests/r/myisam.result (+16/-16)
To merge this branch: bzr merge lp:~jaypipes/drizzle/replication-raw-sql
Reviewer Review Type Date Requested Status
Brian Aker Pending
Drizzle Developers Pending
Review via email: mp+20489@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jay Pipes (jaypipes) wrote :

Hi!

This patch removes 4 places where we were still using statement-based replication:

DROP SCHEMA
CREATE SCHEMA
DROP TABLE
CREATE TABLE

Now, all of the above are written to the replication stream as specific message::Statement subclasses describing the changes to be made to the server's state.

This also fixes Bug#527992 (Multi-column Primary Key not handled in replication)

Cheers,

Jay

Revision history for this message
Brian Aker (brianaker) wrote :

Hi!

Looks fine, but I may want to revisit how we are doing the
transformation messages at a later point (namely the API/etc).

I need to take a look at SHOW CREATE TABLE/SCHEMA and transform those
in functions. Then use the message output you have in transform.

Cheers,
 -Brian

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/cursor.cc'
2--- drizzled/cursor.cc 2010-02-23 18:09:22 +0000
3+++ drizzled/cursor.cc 2010-03-02 21:04:16 +0000
4@@ -1353,6 +1353,18 @@
5
6 switch (session->lex->sql_command)
7 {
8+ case SQLCOM_CREATE_TABLE:
9+ /*
10+ * We are in a CREATE TABLE ... SELECT statement
11+ * and the kernel has already created the table
12+ * and put a CreateTableStatement in the active
13+ * Transaction message. Here, we add a new InsertRecord
14+ * to a new Transaction message (because the above
15+ * CREATE TABLE will commit the transaction containing
16+ * it).
17+ */
18+ result= replication_services.insertRecord(session, table);
19+ break;
20 case SQLCOM_REPLACE:
21 case SQLCOM_REPLACE_SELECT:
22 /*
23
24=== modified file 'drizzled/db.cc'
25--- drizzled/db.cc 2010-03-01 23:42:31 +0000
26+++ drizzled/db.cc 2010-03-02 21:04:16 +0000
27@@ -129,7 +129,7 @@
28 }
29 else // Created !
30 {
31- replication_services.rawStatement(session, session->query);
32+ replication_services.createSchema(session, schema_message);
33 session->my_ok(1);
34 }
35
36@@ -275,7 +275,7 @@
37 assert(! session->query.empty());
38
39 ReplicationServices &replication_services= ReplicationServices::singleton();
40- replication_services.rawStatement(session, session->getQueryString());
41+ replication_services.dropSchema(session, schema_name);
42 session->clear_error();
43 session->server_status|= SERVER_STATUS_DB_DROPPED;
44 session->my_ok((uint32_t) deleted);
45
46=== modified file 'drizzled/join.cc'
47--- drizzled/join.cc 2010-02-11 20:01:37 +0000
48+++ drizzled/join.cc 2010-03-02 21:04:16 +0000
49@@ -337,6 +337,12 @@
50 if (error)
51 goto err;
52
53+ /*
54+ * The below will create the new table for
55+ * CREATE TABLE ... SELECT
56+ *
57+ * @see create_table_from_items() in drizzled/sql_insert.cc
58+ */
59 if (result && result->prepare(fields_list, unit_arg))
60 goto err;
61
62
63=== modified file 'drizzled/message/statement_transform.cc'
64--- drizzled/message/statement_transform.cc 2010-02-08 01:10:03 +0000
65+++ drizzled/message/statement_transform.cc 2010-03-02 21:04:16 +0000
66@@ -2,10 +2,11 @@
67 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
68 *
69 * Copyright (C) 2009 Sun Microsystems
70+ * Copyright (c) 2010 Jay Pipes
71 *
72 * Authors:
73 *
74- * Jay Pipes <joinfu@sun.com>
75+ * Jay Pipes <jaypipes@gmail.com>
76 *
77 * This program is free software; you can redistribute it and/or modify
78 * it under the terms of the GNU General Public License as published by
79@@ -36,23 +37,27 @@
80
81 #include <string>
82 #include <vector>
83+#include <sstream>
84
85 using namespace std;
86
87 namespace drizzled
88 {
89
90-enum message::TransformSqlError
91-message::transformStatementToSql(const message::Statement &source,
92- vector<string> &sql_strings,
93- enum message::TransformSqlVariant sql_variant,
94- bool already_in_transaction)
95-{
96- message::TransformSqlError error= NONE;
97+namespace message
98+{
99+
100+enum TransformSqlError
101+transformStatementToSql(const Statement &source,
102+ vector<string> &sql_strings,
103+ enum TransformSqlVariant sql_variant,
104+ bool already_in_transaction)
105+{
106+ TransformSqlError error= NONE;
107
108 switch (source.type())
109 {
110- case message::Statement::INSERT:
111+ case Statement::INSERT:
112 {
113 if (! source.has_insert_header())
114 {
115@@ -65,8 +70,8 @@
116 return error;
117 }
118
119- const message::InsertHeader &insert_header= source.insert_header();
120- const message::InsertData &insert_data= source.insert_data();
121+ const InsertHeader &insert_header= source.insert_header();
122+ const InsertData &insert_data= source.insert_data();
123 size_t num_keys= insert_data.record_size();
124 size_t x;
125
126@@ -79,7 +84,7 @@
127
128 error= transformInsertRecordToSql(insert_header,
129 insert_data.record(x),
130- &destination,
131+ destination,
132 sql_variant);
133 if (error != NONE)
134 break;
135@@ -96,7 +101,7 @@
136 }
137 }
138 break;
139- case message::Statement::UPDATE:
140+ case Statement::UPDATE:
141 {
142 if (! source.has_update_header())
143 {
144@@ -109,8 +114,8 @@
145 return error;
146 }
147
148- const message::UpdateHeader &update_header= source.update_header();
149- const message::UpdateData &update_data= source.update_data();
150+ const UpdateHeader &update_header= source.update_header();
151+ const UpdateData &update_data= source.update_data();
152 size_t num_keys= update_data.record_size();
153 size_t x;
154
155@@ -123,7 +128,7 @@
156
157 error= transformUpdateRecordToSql(update_header,
158 update_data.record(x),
159- &destination,
160+ destination,
161 sql_variant);
162 if (error != NONE)
163 break;
164@@ -140,7 +145,7 @@
165 }
166 }
167 break;
168- case message::Statement::DELETE:
169+ case Statement::DELETE:
170 {
171 if (! source.has_delete_header())
172 {
173@@ -153,8 +158,8 @@
174 return error;
175 }
176
177- const message::DeleteHeader &delete_header= source.delete_header();
178- const message::DeleteData &delete_data= source.delete_data();
179+ const DeleteHeader &delete_header= source.delete_header();
180+ const DeleteData &delete_data= source.delete_data();
181 size_t num_keys= delete_data.record_size();
182 size_t x;
183
184@@ -167,7 +172,7 @@
185
186 error= transformDeleteRecordToSql(delete_header,
187 delete_data.record(x),
188- &destination,
189+ destination,
190 sql_variant);
191 if (error != NONE)
192 break;
193@@ -184,27 +189,67 @@
194 }
195 }
196 break;
197- case message::Statement::TRUNCATE_TABLE:
198+ case Statement::CREATE_TABLE:
199+ {
200+ assert(source.has_create_table_statement());
201+ string destination;
202+ error= transformCreateTableStatementToSql(source.create_table_statement(),
203+ destination,
204+ sql_variant);
205+ sql_strings.push_back(destination);
206+ }
207+ break;
208+ case Statement::TRUNCATE_TABLE:
209 {
210 assert(source.has_truncate_table_statement());
211 string destination;
212- error= message::transformTruncateTableStatementToSql(source.truncate_table_statement(),
213- &destination,
214- sql_variant);
215- sql_strings.push_back(destination);
216- }
217- break;
218- case message::Statement::SET_VARIABLE:
219+ error= transformTruncateTableStatementToSql(source.truncate_table_statement(),
220+ destination,
221+ sql_variant);
222+ sql_strings.push_back(destination);
223+ }
224+ break;
225+ case Statement::DROP_TABLE:
226+ {
227+ assert(source.has_drop_table_statement());
228+ string destination;
229+ error= transformDropTableStatementToSql(source.drop_table_statement(),
230+ destination,
231+ sql_variant);
232+ sql_strings.push_back(destination);
233+ }
234+ break;
235+ case Statement::CREATE_SCHEMA:
236+ {
237+ assert(source.has_create_schema_statement());
238+ string destination;
239+ error= transformCreateSchemaStatementToSql(source.create_schema_statement(),
240+ destination,
241+ sql_variant);
242+ sql_strings.push_back(destination);
243+ }
244+ break;
245+ case Statement::DROP_SCHEMA:
246+ {
247+ assert(source.has_drop_schema_statement());
248+ string destination;
249+ error= transformDropSchemaStatementToSql(source.drop_schema_statement(),
250+ destination,
251+ sql_variant);
252+ sql_strings.push_back(destination);
253+ }
254+ break;
255+ case Statement::SET_VARIABLE:
256 {
257 assert(source.has_set_variable_statement());
258 string destination;
259- error= message::transformSetVariableStatementToSql(source.set_variable_statement(),
260- &destination,
261- sql_variant);
262+ error= transformSetVariableStatementToSql(source.set_variable_statement(),
263+ destination,
264+ sql_variant);
265 sql_strings.push_back(destination);
266 }
267 break;
268- case message::Statement::RAW_SQL:
269+ case Statement::RAW_SQL:
270 default:
271 sql_strings.push_back(source.sql());
272 break;
273@@ -212,24 +257,24 @@
274 return error;
275 }
276
277-enum message::TransformSqlError
278-message::transformInsertHeaderToSql(const message::InsertHeader &header,
279- std::string *destination,
280- enum message::TransformSqlVariant sql_variant)
281+enum TransformSqlError
282+transformInsertHeaderToSql(const InsertHeader &header,
283+ string &destination,
284+ enum TransformSqlVariant sql_variant)
285 {
286 char quoted_identifier= '`';
287 if (sql_variant == ANSI)
288 quoted_identifier= '"';
289
290- destination->assign("INSERT INTO ", 12);
291- destination->push_back(quoted_identifier);
292- destination->append(header.table_metadata().schema_name());
293- destination->push_back(quoted_identifier);
294- destination->push_back('.');
295- destination->push_back(quoted_identifier);
296- destination->append(header.table_metadata().table_name());
297- destination->push_back(quoted_identifier);
298- destination->append(" (", 2);
299+ destination.assign("INSERT INTO ", 12);
300+ destination.push_back(quoted_identifier);
301+ destination.append(header.table_metadata().schema_name());
302+ destination.push_back(quoted_identifier);
303+ destination.push_back('.');
304+ destination.push_back(quoted_identifier);
305+ destination.append(header.table_metadata().table_name());
306+ destination.push_back(quoted_identifier);
307+ destination.append(" (", 2);
308
309 /* Add field list to SQL string... */
310 size_t num_fields= header.field_metadata_size();
311@@ -237,33 +282,33 @@
312
313 for (x= 0; x < num_fields; ++x)
314 {
315- const message::FieldMetadata &field_metadata= header.field_metadata(x);
316+ const FieldMetadata &field_metadata= header.field_metadata(x);
317 if (x != 0)
318- destination->push_back(',');
319+ destination.push_back(',');
320
321- destination->push_back(quoted_identifier);
322- destination->append(field_metadata.name());
323- destination->push_back(quoted_identifier);
324+ destination.push_back(quoted_identifier);
325+ destination.append(field_metadata.name());
326+ destination.push_back(quoted_identifier);
327 }
328
329 return NONE;
330 }
331
332-enum message::TransformSqlError
333-message::transformInsertRecordToSql(const message::InsertHeader &header,
334- const message::InsertRecord &record,
335- std::string *destination,
336- enum message::TransformSqlVariant sql_variant)
337+enum TransformSqlError
338+transformInsertRecordToSql(const InsertHeader &header,
339+ const InsertRecord &record,
340+ string &destination,
341+ enum TransformSqlVariant sql_variant)
342 {
343- enum message::TransformSqlError error= transformInsertHeaderToSql(header,
344- destination,
345- sql_variant);
346+ enum TransformSqlError error= transformInsertHeaderToSql(header,
347+ destination,
348+ sql_variant);
349
350 char quoted_identifier= '`';
351 if (sql_variant == ANSI)
352 quoted_identifier= '"';
353
354- destination->append(") VALUES (");
355+ destination.append(") VALUES (");
356
357 /* Add insert values */
358 size_t num_fields= header.field_metadata_size();
359@@ -273,16 +318,16 @@
360 for (x= 0; x < num_fields; ++x)
361 {
362 if (x != 0)
363- destination->push_back(',');
364-
365- const message::FieldMetadata &field_metadata= header.field_metadata(x);
366-
367- should_quote_field_value= message::shouldQuoteFieldValue(field_metadata.type());
368+ destination.push_back(',');
369+
370+ const FieldMetadata &field_metadata= header.field_metadata(x);
371+
372+ should_quote_field_value= shouldQuoteFieldValue(field_metadata.type());
373
374 if (should_quote_field_value)
375- destination->push_back('\'');
376+ destination.push_back('\'');
377
378- if (field_metadata.type() == message::Table::Field::BLOB)
379+ if (field_metadata.type() == Table::Field::BLOB)
380 {
381 /*
382 * We do this here because BLOB data is returned
383@@ -291,36 +336,36 @@
384 * up to a \0 being output here.
385 */
386 string raw_data(record.insert_value(x));
387- destination->append(raw_data.c_str(), raw_data.size());
388+ destination.append(raw_data.c_str(), raw_data.size());
389 }
390 else
391 {
392- destination->append(record.insert_value(x));
393+ destination.append(record.insert_value(x));
394 }
395
396 if (should_quote_field_value)
397- destination->push_back('\'');
398+ destination.push_back('\'');
399 }
400- destination->push_back(')');
401+ destination.push_back(')');
402
403 return error;
404 }
405
406-enum message::TransformSqlError
407-message::transformInsertStatementToSql(const message::InsertHeader &header,
408- const message::InsertData &data,
409- std::string *destination,
410- enum message::TransformSqlVariant sql_variant)
411+enum TransformSqlError
412+transformInsertStatementToSql(const InsertHeader &header,
413+ const InsertData &data,
414+ string &destination,
415+ enum TransformSqlVariant sql_variant)
416 {
417- enum message::TransformSqlError error= transformInsertHeaderToSql(header,
418- destination,
419- sql_variant);
420+ enum TransformSqlError error= transformInsertHeaderToSql(header,
421+ destination,
422+ sql_variant);
423
424 char quoted_identifier= '`';
425 if (sql_variant == ANSI)
426 quoted_identifier= '"';
427
428- destination->append(") VALUES (", 10);
429+ destination.append(") VALUES (", 10);
430
431 /* Add insert values */
432 size_t num_records= data.record_size();
433@@ -331,21 +376,21 @@
434 for (x= 0; x < num_records; ++x)
435 {
436 if (x != 0)
437- destination->append("),(", 3);
438+ destination.append("),(", 3);
439
440 for (y= 0; y < num_fields; ++y)
441 {
442 if (y != 0)
443- destination->push_back(',');
444+ destination.push_back(',');
445
446- const message::FieldMetadata &field_metadata= header.field_metadata(y);
447+ const FieldMetadata &field_metadata= header.field_metadata(y);
448
449- should_quote_field_value= message::shouldQuoteFieldValue(field_metadata.type());
450+ should_quote_field_value= shouldQuoteFieldValue(field_metadata.type());
451
452 if (should_quote_field_value)
453- destination->push_back('\'');
454+ destination.push_back('\'');
455
456- if (field_metadata.type() == message::Table::Field::BLOB)
457+ if (field_metadata.type() == Table::Field::BLOB)
458 {
459 /*
460 * We do this here because BLOB data is returned
461@@ -354,53 +399,53 @@
462 * up to a \0 being output here.
463 */
464 string raw_data(data.record(x).insert_value(y));
465- destination->append(raw_data.c_str(), raw_data.size());
466+ destination.append(raw_data.c_str(), raw_data.size());
467 }
468 else
469 {
470- destination->append(data.record(x).insert_value(y));
471+ destination.append(data.record(x).insert_value(y));
472 }
473
474 if (should_quote_field_value)
475- destination->push_back('\'');
476+ destination.push_back('\'');
477 }
478 }
479- destination->push_back(')');
480+ destination.push_back(')');
481
482 return error;
483 }
484
485-enum message::TransformSqlError
486-message::transformUpdateHeaderToSql(const message::UpdateHeader &header,
487- std::string *destination,
488- enum message::TransformSqlVariant sql_variant)
489+enum TransformSqlError
490+transformUpdateHeaderToSql(const UpdateHeader &header,
491+ string &destination,
492+ enum TransformSqlVariant sql_variant)
493 {
494 char quoted_identifier= '`';
495 if (sql_variant == ANSI)
496 quoted_identifier= '"';
497
498- destination->assign("UPDATE ", 7);
499- destination->push_back(quoted_identifier);
500- destination->append(header.table_metadata().schema_name());
501- destination->push_back(quoted_identifier);
502- destination->push_back('.');
503- destination->push_back(quoted_identifier);
504- destination->append(header.table_metadata().table_name());
505- destination->push_back(quoted_identifier);
506- destination->append(" SET ", 5);
507+ destination.assign("UPDATE ", 7);
508+ destination.push_back(quoted_identifier);
509+ destination.append(header.table_metadata().schema_name());
510+ destination.push_back(quoted_identifier);
511+ destination.push_back('.');
512+ destination.push_back(quoted_identifier);
513+ destination.append(header.table_metadata().table_name());
514+ destination.push_back(quoted_identifier);
515+ destination.append(" SET ", 5);
516
517 return NONE;
518 }
519
520-enum message::TransformSqlError
521-message::transformUpdateRecordToSql(const message::UpdateHeader &header,
522- const message::UpdateRecord &record,
523- std::string *destination,
524- enum message::TransformSqlVariant sql_variant)
525+enum TransformSqlError
526+transformUpdateRecordToSql(const UpdateHeader &header,
527+ const UpdateRecord &record,
528+ string &destination,
529+ enum TransformSqlVariant sql_variant)
530 {
531- enum message::TransformSqlError error= transformUpdateHeaderToSql(header,
532- destination,
533- sql_variant);
534+ enum TransformSqlError error= transformUpdateHeaderToSql(header,
535+ destination,
536+ sql_variant);
537
538 char quoted_identifier= '`';
539 if (sql_variant == ANSI)
540@@ -413,21 +458,21 @@
541
542 for (x= 0; x < num_set_fields; ++x)
543 {
544- const message::FieldMetadata &field_metadata= header.set_field_metadata(x);
545+ const FieldMetadata &field_metadata= header.set_field_metadata(x);
546 if (x != 0)
547- destination->push_back(',');
548+ destination.push_back(',');
549
550- destination->push_back(quoted_identifier);
551- destination->append(field_metadata.name());
552- destination->push_back(quoted_identifier);
553- destination->push_back('=');
554+ destination.push_back(quoted_identifier);
555+ destination.append(field_metadata.name());
556+ destination.push_back(quoted_identifier);
557+ destination.push_back('=');
558
559- should_quote_field_value= message::shouldQuoteFieldValue(field_metadata.type());
560+ should_quote_field_value= shouldQuoteFieldValue(field_metadata.type());
561
562 if (should_quote_field_value)
563- destination->push_back('\'');
564+ destination.push_back('\'');
565
566- if (field_metadata.type() == message::Table::Field::BLOB)
567+ if (field_metadata.type() == Table::Field::BLOB)
568 {
569 /*
570 * We do this here because BLOB data is returned
571@@ -436,39 +481,39 @@
572 * up to a \0 being output here.
573 */
574 string raw_data(record.after_value(x));
575- destination->append(raw_data.c_str(), raw_data.size());
576+ destination.append(raw_data.c_str(), raw_data.size());
577 }
578 else
579 {
580- destination->append(record.after_value(x));
581+ destination.append(record.after_value(x));
582 }
583
584 if (should_quote_field_value)
585- destination->push_back('\'');
586+ destination.push_back('\'');
587 }
588
589 size_t num_key_fields= header.key_field_metadata_size();
590
591- destination->append(" WHERE ", 7);
592+ destination.append(" WHERE ", 7);
593 for (x= 0; x < num_key_fields; ++x)
594 {
595- const message::FieldMetadata &field_metadata= header.key_field_metadata(x);
596+ const FieldMetadata &field_metadata= header.key_field_metadata(x);
597
598 if (x != 0)
599- destination->append(" AND ", 5); /* Always AND condition with a multi-column PK */
600-
601- destination->push_back(quoted_identifier);
602- destination->append(field_metadata.name());
603- destination->push_back(quoted_identifier);
604-
605- destination->push_back('=');
606-
607- should_quote_field_value= message::shouldQuoteFieldValue(field_metadata.type());
608+ destination.append(" AND ", 5); /* Always AND condition with a multi-column PK */
609+
610+ destination.push_back(quoted_identifier);
611+ destination.append(field_metadata.name());
612+ destination.push_back(quoted_identifier);
613+
614+ destination.push_back('=');
615+
616+ should_quote_field_value= shouldQuoteFieldValue(field_metadata.type());
617
618 if (should_quote_field_value)
619- destination->push_back('\'');
620+ destination.push_back('\'');
621
622- if (field_metadata.type() == message::Table::Field::BLOB)
623+ if (field_metadata.type() == Table::Field::BLOB)
624 {
625 /*
626 * We do this here because BLOB data is returned
627@@ -477,52 +522,50 @@
628 * up to a \0 being output here.
629 */
630 string raw_data(record.key_value(x));
631- destination->append(raw_data.c_str(), raw_data.size());
632+ destination.append(raw_data.c_str(), raw_data.size());
633 }
634 else
635 {
636- destination->append(record.key_value(x));
637+ destination.append(record.key_value(x));
638 }
639
640 if (should_quote_field_value)
641- destination->push_back('\'');
642+ destination.push_back('\'');
643 }
644- if (num_key_fields > 1)
645- destination->push_back(')');
646
647 return error;
648 }
649
650-enum message::TransformSqlError
651-message::transformDeleteHeaderToSql(const message::DeleteHeader &header,
652- std::string *destination,
653- enum message::TransformSqlVariant sql_variant)
654+enum TransformSqlError
655+transformDeleteHeaderToSql(const DeleteHeader &header,
656+ string &destination,
657+ enum TransformSqlVariant sql_variant)
658 {
659 char quoted_identifier= '`';
660 if (sql_variant == ANSI)
661 quoted_identifier= '"';
662
663- destination->assign("DELETE FROM ", 12);
664- destination->push_back(quoted_identifier);
665- destination->append(header.table_metadata().schema_name());
666- destination->push_back(quoted_identifier);
667- destination->push_back('.');
668- destination->push_back(quoted_identifier);
669- destination->append(header.table_metadata().table_name());
670- destination->push_back(quoted_identifier);
671+ destination.assign("DELETE FROM ", 12);
672+ destination.push_back(quoted_identifier);
673+ destination.append(header.table_metadata().schema_name());
674+ destination.push_back(quoted_identifier);
675+ destination.push_back('.');
676+ destination.push_back(quoted_identifier);
677+ destination.append(header.table_metadata().table_name());
678+ destination.push_back(quoted_identifier);
679
680 return NONE;
681 }
682
683-enum message::TransformSqlError
684-message::transformDeleteRecordToSql(const message::DeleteHeader &header,
685- const message::DeleteRecord &record,
686- std::string *destination,
687- enum message::TransformSqlVariant sql_variant)
688+enum TransformSqlError
689+transformDeleteRecordToSql(const DeleteHeader &header,
690+ const DeleteRecord &record,
691+ string &destination,
692+ enum TransformSqlVariant sql_variant)
693 {
694- enum message::TransformSqlError error= transformDeleteHeaderToSql(header,
695- destination,
696- sql_variant);
697+ enum TransformSqlError error= transformDeleteHeaderToSql(header,
698+ destination,
699+ sql_variant);
700 char quoted_identifier= '`';
701 if (sql_variant == ANSI)
702 quoted_identifier= '"';
703@@ -532,26 +575,26 @@
704 uint32_t x;
705 bool should_quote_field_value= false;
706
707- destination->append(" WHERE ", 7);
708+ destination.append(" WHERE ", 7);
709 for (x= 0; x < num_key_fields; ++x)
710 {
711- const message::FieldMetadata &field_metadata= header.key_field_metadata(x);
712+ const FieldMetadata &field_metadata= header.key_field_metadata(x);
713
714 if (x != 0)
715- destination->append(" AND ", 5); /* Always AND condition with a multi-column PK */
716-
717- destination->push_back(quoted_identifier);
718- destination->append(field_metadata.name());
719- destination->push_back(quoted_identifier);
720-
721- destination->push_back('=');
722-
723- should_quote_field_value= message::shouldQuoteFieldValue(field_metadata.type());
724+ destination.append(" AND ", 5); /* Always AND condition with a multi-column PK */
725+
726+ destination.push_back(quoted_identifier);
727+ destination.append(field_metadata.name());
728+ destination.push_back(quoted_identifier);
729+
730+ destination.push_back('=');
731+
732+ should_quote_field_value= shouldQuoteFieldValue(field_metadata.type());
733
734 if (should_quote_field_value)
735- destination->push_back('\'');
736+ destination.push_back('\'');
737
738- if (field_metadata.type() == message::Table::Field::BLOB)
739+ if (field_metadata.type() == Table::Field::BLOB)
740 {
741 /*
742 * We do this here because BLOB data is returned
743@@ -560,29 +603,29 @@
744 * up to a \0 being output here.
745 */
746 string raw_data(record.key_value(x));
747- destination->append(raw_data.c_str(), raw_data.size());
748+ destination.append(raw_data.c_str(), raw_data.size());
749 }
750 else
751 {
752- destination->append(record.key_value(x));
753+ destination.append(record.key_value(x));
754 }
755
756 if (should_quote_field_value)
757- destination->push_back('\'');
758+ destination.push_back('\'');
759 }
760
761 return error;
762 }
763
764-enum message::TransformSqlError
765-message::transformDeleteStatementToSql(const message::DeleteHeader &header,
766- const message::DeleteData &data,
767- std::string *destination,
768- enum message::TransformSqlVariant sql_variant)
769+enum TransformSqlError
770+transformDeleteStatementToSql(const DeleteHeader &header,
771+ const DeleteData &data,
772+ string &destination,
773+ enum TransformSqlVariant sql_variant)
774 {
775- enum message::TransformSqlError error= transformDeleteHeaderToSql(header,
776- destination,
777- sql_variant);
778+ enum TransformSqlError error= transformDeleteHeaderToSql(header,
779+ destination,
780+ sql_variant);
781 char quoted_identifier= '`';
782 if (sql_variant == ANSI)
783 quoted_identifier= '"';
784@@ -593,34 +636,34 @@
785 uint32_t x, y;
786 bool should_quote_field_value= false;
787
788- destination->append(" WHERE ", 7);
789+ destination.append(" WHERE ", 7);
790 for (x= 0; x < num_key_records; ++x)
791 {
792 if (x != 0)
793- destination->append(" OR ", 4); /* Always OR condition for multiple key records */
794+ destination.append(" OR ", 4); /* Always OR condition for multiple key records */
795
796 if (num_key_fields > 1)
797- destination->push_back('(');
798+ destination.push_back('(');
799
800 for (y= 0; y < num_key_fields; ++y)
801 {
802- const message::FieldMetadata &field_metadata= header.key_field_metadata(y);
803+ const FieldMetadata &field_metadata= header.key_field_metadata(y);
804
805 if (y != 0)
806- destination->append(" AND ", 5); /* Always AND condition with a multi-column PK */
807-
808- destination->push_back(quoted_identifier);
809- destination->append(field_metadata.name());
810- destination->push_back(quoted_identifier);
811-
812- destination->push_back('=');
813-
814- should_quote_field_value= message::shouldQuoteFieldValue(field_metadata.type());
815+ destination.append(" AND ", 5); /* Always AND condition with a multi-column PK */
816+
817+ destination.push_back(quoted_identifier);
818+ destination.append(field_metadata.name());
819+ destination.push_back(quoted_identifier);
820+
821+ destination.push_back('=');
822+
823+ should_quote_field_value= shouldQuoteFieldValue(field_metadata.type());
824
825 if (should_quote_field_value)
826- destination->push_back('\'');
827+ destination.push_back('\'');
828
829- if (field_metadata.type() == message::Table::Field::BLOB)
830+ if (field_metadata.type() == Table::Field::BLOB)
831 {
832 /*
833 * We do this here because BLOB data is returned
834@@ -629,114 +672,607 @@
835 * up to a \0 being output here.
836 */
837 string raw_data(data.record(x).key_value(y));
838- destination->append(raw_data.c_str(), raw_data.size());
839+ destination.append(raw_data.c_str(), raw_data.size());
840 }
841 else
842 {
843- destination->append(data.record(x).key_value(y));
844+ destination.append(data.record(x).key_value(y));
845 }
846
847 if (should_quote_field_value)
848- destination->push_back('\'');
849+ destination.push_back('\'');
850 }
851 if (num_key_fields > 1)
852- destination->push_back(')');
853+ destination.push_back(')');
854 }
855 return error;
856 }
857
858-enum message::TransformSqlError
859-message::transformTruncateTableStatementToSql(const message::TruncateTableStatement &statement,
860- std::string *destination,
861- enum message::TransformSqlVariant sql_variant)
862-{
863- char quoted_identifier= '`';
864- if (sql_variant == ANSI)
865- quoted_identifier= '"';
866-
867- const message::TableMetadata &table_metadata= statement.table_metadata();
868-
869- destination->append("TRUNCATE TABLE ", 15);
870- destination->push_back(quoted_identifier);
871- destination->append(table_metadata.schema_name());
872- destination->push_back(quoted_identifier);
873- destination->push_back('.');
874- destination->push_back(quoted_identifier);
875- destination->append(table_metadata.table_name());
876- destination->push_back(quoted_identifier);
877-
878- return NONE;
879-}
880-
881-enum message::TransformSqlError
882-message::transformSetVariableStatementToSql(const message::SetVariableStatement &statement,
883- std::string *destination,
884- enum message::TransformSqlVariant sql_variant)
885+enum TransformSqlError
886+transformDropSchemaStatementToSql(const DropSchemaStatement &statement,
887+ string &destination,
888+ enum TransformSqlVariant sql_variant)
889+{
890+ char quoted_identifier= '`';
891+ if (sql_variant == ANSI)
892+ quoted_identifier= '"';
893+
894+ destination.append("DROP SCHEMA ", 12);
895+ destination.push_back(quoted_identifier);
896+ destination.append(statement.schema_name());
897+ destination.push_back(quoted_identifier);
898+
899+ return NONE;
900+}
901+
902+enum TransformSqlError
903+transformCreateSchemaStatementToSql(const CreateSchemaStatement &statement,
904+ string &destination,
905+ enum TransformSqlVariant sql_variant)
906+{
907+ char quoted_identifier= '`';
908+ if (sql_variant == ANSI)
909+ quoted_identifier= '"';
910+
911+ const Schema &schema= statement.schema();
912+
913+ destination.append("CREATE SCHEMA ", 14);
914+ destination.push_back(quoted_identifier);
915+ destination.append(schema.name());
916+ destination.push_back(quoted_identifier);
917+
918+ if (schema.has_collation())
919+ {
920+ destination.append(" COLLATE ", 9);
921+ destination.append(schema.collation());
922+ }
923+
924+ return NONE;
925+}
926+
927+enum TransformSqlError
928+transformDropTableStatementToSql(const DropTableStatement &statement,
929+ string &destination,
930+ enum TransformSqlVariant sql_variant)
931+{
932+ char quoted_identifier= '`';
933+ if (sql_variant == ANSI)
934+ quoted_identifier= '"';
935+
936+ const TableMetadata &table_metadata= statement.table_metadata();
937+
938+ destination.append("DROP TABLE ", 11);
939+
940+ /* Add the IF EXISTS clause if necessary */
941+ if (statement.has_if_exists_clause() &&
942+ statement.if_exists_clause() == true)
943+ {
944+ destination.append("IF EXISTS ", 10);
945+ }
946+
947+ destination.push_back(quoted_identifier);
948+ destination.append(table_metadata.schema_name());
949+ destination.push_back(quoted_identifier);
950+ destination.push_back('.');
951+ destination.push_back(quoted_identifier);
952+ destination.append(table_metadata.table_name());
953+ destination.push_back(quoted_identifier);
954+
955+ return NONE;
956+}
957+
958+enum TransformSqlError
959+transformTruncateTableStatementToSql(const TruncateTableStatement &statement,
960+ string &destination,
961+ enum TransformSqlVariant sql_variant)
962+{
963+ char quoted_identifier= '`';
964+ if (sql_variant == ANSI)
965+ quoted_identifier= '"';
966+
967+ const TableMetadata &table_metadata= statement.table_metadata();
968+
969+ destination.append("TRUNCATE TABLE ", 15);
970+ destination.push_back(quoted_identifier);
971+ destination.append(table_metadata.schema_name());
972+ destination.push_back(quoted_identifier);
973+ destination.push_back('.');
974+ destination.push_back(quoted_identifier);
975+ destination.append(table_metadata.table_name());
976+ destination.push_back(quoted_identifier);
977+
978+ return NONE;
979+}
980+
981+enum TransformSqlError
982+transformSetVariableStatementToSql(const SetVariableStatement &statement,
983+ string &destination,
984+ enum TransformSqlVariant sql_variant)
985 {
986 (void) sql_variant;
987- const message::FieldMetadata &variable_metadata= statement.variable_metadata();
988- bool should_quote_field_value= message::shouldQuoteFieldValue(variable_metadata.type());
989-
990- destination->append("SET GLOBAL ", 11); /* Only global variables are replicated */
991- destination->append(variable_metadata.name());
992- destination->push_back('=');
993-
994- if (should_quote_field_value)
995- destination->push_back('\'');
996-
997- destination->append(statement.variable_value());
998-
999- if (should_quote_field_value)
1000- destination->push_back('\'');
1001-
1002- return NONE;
1003-}
1004-
1005-bool message::shouldQuoteFieldValue(message::Table::Field::FieldType in_type)
1006+ const FieldMetadata &variable_metadata= statement.variable_metadata();
1007+ bool should_quote_field_value= shouldQuoteFieldValue(variable_metadata.type());
1008+
1009+ destination.append("SET GLOBAL ", 11); /* Only global variables are replicated */
1010+ destination.append(variable_metadata.name());
1011+ destination.push_back('=');
1012+
1013+ if (should_quote_field_value)
1014+ destination.push_back('\'');
1015+
1016+ destination.append(statement.variable_value());
1017+
1018+ if (should_quote_field_value)
1019+ destination.push_back('\'');
1020+
1021+ return NONE;
1022+}
1023+
1024+enum TransformSqlError
1025+transformCreateTableStatementToSql(const CreateTableStatement &statement,
1026+ string &destination,
1027+ enum TransformSqlVariant sql_variant)
1028+{
1029+ return transformTableDefinitionToSql(statement.table(), destination, sql_variant);
1030+}
1031+
1032+enum TransformSqlError
1033+transformTableDefinitionToSql(const Table &table,
1034+ string &destination,
1035+ enum TransformSqlVariant sql_variant)
1036+{
1037+ char quoted_identifier= '`';
1038+ if (sql_variant == ANSI)
1039+ quoted_identifier= '"';
1040+
1041+ destination.append("CREATE ", 7);
1042+
1043+ if (table.type() == Table::TEMPORARY)
1044+ destination.append("TEMPORARY ", 10);
1045+
1046+ destination.append("TABLE ", 6);
1047+ destination.push_back(quoted_identifier);
1048+ destination.append(table.name());
1049+ destination.push_back(quoted_identifier);
1050+ destination.append(" (\n", 3);
1051+
1052+ enum TransformSqlError result= NONE;
1053+ size_t num_fields= table.field_size();
1054+ for (size_t x= 0; x < num_fields; ++x)
1055+ {
1056+ const Table::Field &field= table.field(x);
1057+
1058+ if (x != 0)
1059+ destination.append(",\n", 2);
1060+
1061+ result= transformFieldDefinitionToSql(field, destination, sql_variant);
1062+
1063+ if (result != NONE)
1064+ return result;
1065+ }
1066+
1067+ size_t num_indexes= table.indexes_size();
1068+
1069+ if (num_indexes > 0)
1070+ destination.append(",\n", 2);
1071+
1072+ for (size_t x= 0; x < num_indexes; ++x)
1073+ {
1074+ const message::Table::Index &index= table.indexes(x);
1075+
1076+ if (x != 0)
1077+ destination.append(",\n", 2);
1078+
1079+ result= transformIndexDefinitionToSql(index, table, destination, sql_variant);
1080+
1081+ if (result != NONE)
1082+ return result;
1083+ }
1084+ destination.append("\n)", 2);
1085+
1086+ /* Add ENGINE = " clause */
1087+ if (table.has_engine())
1088+ {
1089+ const Table::StorageEngine &engine= table.engine();
1090+ destination.append("\nENGINE = ", 10);
1091+ destination.append(engine.name());
1092+
1093+ size_t num_engine_options= engine.option_size();
1094+ for (size_t x= 0; x < num_engine_options; ++x)
1095+ {
1096+ const Table::StorageEngine::EngineOption &option= engine.option(x);
1097+ destination.push_back('\n');
1098+ destination.append(option.option_name());
1099+ destination.append(" = ", 3);
1100+ destination.append(option.option_value());
1101+ destination.push_back('\n');
1102+ }
1103+ }
1104+
1105+ if (table.has_options())
1106+ (void) transformTableOptionsToSql(table.options(), destination, sql_variant);
1107+
1108+ return NONE;
1109+}
1110+
1111+enum TransformSqlError
1112+transformTableOptionsToSql(const Table::TableOptions &options,
1113+ string &destination,
1114+ enum TransformSqlVariant sql_variant)
1115+{
1116+ if (sql_variant == ANSI)
1117+ return NONE; /* ANSI does not support table options... */
1118+
1119+ stringstream ss;
1120+
1121+ if (options.has_comment())
1122+ {
1123+ destination.append("\nCOMMENT = '", 12);
1124+ destination.append(options.comment());
1125+ destination.push_back('\'');
1126+ }
1127+
1128+ if (options.has_collation())
1129+ {
1130+ destination.append("\nCOLLATE = ", 11);
1131+ destination.append(options.collation());
1132+ }
1133+
1134+ if (options.has_auto_increment())
1135+ {
1136+ ss << options.auto_increment();
1137+ destination.append("\nAUTOINCREMENT_OFFSET = ", 24);
1138+ destination.append(ss.str());
1139+ ss.clear();
1140+ }
1141+
1142+ if (options.has_row_type())
1143+ {
1144+ ss << options.row_type();
1145+ destination.append("\nROW_TYPE = ", 12);
1146+ destination.append(ss.str());
1147+ ss.clear();
1148+ }
1149+
1150+ if (options.has_data_file_name())
1151+ {
1152+ destination.append("\nDATA_FILE_NAME = '", 19);
1153+ destination.append(options.data_file_name());
1154+ destination.push_back('\'');
1155+ }
1156+
1157+ if (options.has_index_file_name())
1158+ {
1159+ destination.append("\nINDEX_FILE_NAME = '", 20);
1160+ destination.append(options.index_file_name());
1161+ destination.push_back('\'');
1162+ }
1163+
1164+ if (options.has_max_rows())
1165+ {
1166+ ss << options.max_rows();
1167+ destination.append("\nMAX_ROWS = ", 12);
1168+ destination.append(ss.str());
1169+ ss.clear();
1170+ }
1171+
1172+ if (options.has_min_rows())
1173+ {
1174+ ss << options.min_rows();
1175+ destination.append("\nMIN_ROWS = ", 12);
1176+ destination.append(ss.str());
1177+ ss.clear();
1178+ }
1179+
1180+ if (options.has_auto_increment_value())
1181+ {
1182+ ss << options.auto_increment_value();
1183+ destination.append("\nAUTO_INCREMENT = ", 18);
1184+ destination.append(ss.str());
1185+ ss.clear();
1186+ }
1187+
1188+ if (options.has_avg_row_length())
1189+ {
1190+ ss << options.avg_row_length();
1191+ destination.append("\nAVG_ROW_LENGTH = ", 18);
1192+ destination.append(ss.str());
1193+ ss.clear();
1194+ }
1195+
1196+ if (options.has_key_block_size())
1197+ {
1198+ ss << options.key_block_size();
1199+ destination.append("\nKEY_BLOCK_SIZE = ", 18);
1200+ destination.append(ss.str());
1201+ ss.clear();
1202+ }
1203+
1204+ if (options.has_block_size())
1205+ {
1206+ ss << options.block_size();
1207+ destination.append("\nBLOCK_SIZE = ", 14);
1208+ destination.append(ss.str());
1209+ ss.clear();
1210+ }
1211+
1212+ if (options.has_pack_keys() &&
1213+ options.pack_keys())
1214+ destination.append("\nPACK_KEYS = TRUE", 17);
1215+ if (options.has_pack_record() &&
1216+ options.pack_record())
1217+ destination.append("\nPACK_RECORD = TRUE", 19);
1218+ if (options.has_checksum() &&
1219+ options.checksum())
1220+ destination.append("\nCHECKSUM = TRUE", 16);
1221+ if (options.has_page_checksum() &&
1222+ options.page_checksum())
1223+ destination.append("\nPAGE_CHECKSUM = TRUE", 21);
1224+
1225+ return NONE;
1226+}
1227+
1228+enum TransformSqlError
1229+transformIndexDefinitionToSql(const Table::Index &index,
1230+ const Table &table,
1231+ string &destination,
1232+ enum TransformSqlVariant sql_variant)
1233+{
1234+ char quoted_identifier= '`';
1235+ if (sql_variant == ANSI)
1236+ quoted_identifier= '"';
1237+
1238+ if (index.is_primary())
1239+ destination.append("PRIMARY ", 8);
1240+ else if (index.is_unique())
1241+ destination.append("UNIQUE ", 7);
1242+
1243+ destination.append("KEY ", 4);
1244+ destination.push_back(quoted_identifier);
1245+ destination.append(index.name());
1246+ destination.push_back(quoted_identifier);
1247+ destination.append(" (", 2);
1248+
1249+ size_t num_parts= index.index_part_size();
1250+ for (size_t x= 0; x < num_parts; ++x)
1251+ {
1252+ const Table::Index::IndexPart &part= index.index_part(x);
1253+ const Table::Field &field= table.field(part.fieldnr());
1254+
1255+ if (x != 0)
1256+ destination.push_back(',');
1257+
1258+ destination.push_back(quoted_identifier);
1259+ destination.append(field.name());
1260+ destination.push_back(quoted_identifier);
1261+
1262+ /*
1263+ * If the index part's field type is VARCHAR or TEXT
1264+ * then check for a prefix length then is different
1265+ * from the field's full length...
1266+ */
1267+ if (field.type() == Table::Field::VARCHAR ||
1268+ field.type() == Table::Field::BLOB)
1269+ {
1270+ if (part.has_compare_length())
1271+ {
1272+ size_t compare_length_in_chars= part.compare_length();
1273+
1274+ /* hack: compare_length() is bytes, not chars, but
1275+ * only for VARCHAR. Ass. */
1276+ if (field.type() == Table::Field::VARCHAR)
1277+ compare_length_in_chars/= 4;
1278+
1279+ if (compare_length_in_chars != field.string_options().length())
1280+ {
1281+ stringstream ss;
1282+ destination.push_back('(');
1283+ ss << compare_length_in_chars;
1284+ destination.append(ss.str());
1285+ destination.push_back(')');
1286+ }
1287+ }
1288+ }
1289+ }
1290+ destination.push_back(')');
1291+
1292+ return NONE;
1293+}
1294+
1295+enum TransformSqlError
1296+transformFieldDefinitionToSql(const Table::Field &field,
1297+ string &destination,
1298+ enum TransformSqlVariant sql_variant)
1299+{
1300+ char quoted_identifier= '`';
1301+ if (sql_variant == ANSI)
1302+ quoted_identifier= '"';
1303+
1304+ destination.push_back(quoted_identifier);
1305+ destination.append(field.name());
1306+ destination.push_back(quoted_identifier);
1307+
1308+ Table::Field::FieldType field_type= field.type();
1309+
1310+ switch (field_type)
1311+ {
1312+ case Table::Field::DOUBLE:
1313+ destination.append(" DOUBLE", 7);
1314+ break;
1315+ case Table::Field::VARCHAR:
1316+ {
1317+ destination.append(" VARCHAR(", 9);
1318+ stringstream ss;
1319+ ss << field.string_options().length() << ")";
1320+ destination.append(ss.str());
1321+ }
1322+ break;
1323+ case Table::Field::BLOB:
1324+ destination.append(" BLOB", 5);
1325+ break;
1326+ case Table::Field::ENUM:
1327+ {
1328+ size_t num_field_values= field.set_options().field_value_size();
1329+ destination.append(" ENUM(", 6);
1330+ for (size_t x= 0; x < num_field_values; ++x)
1331+ {
1332+ const string &type= field.set_options().field_value(x);
1333+
1334+ if (x != 0)
1335+ destination.push_back(',');
1336+
1337+ destination.push_back('\'');
1338+ destination.append(type);
1339+ destination.push_back('\'');
1340+ }
1341+ destination.push_back(')');
1342+ break;
1343+ }
1344+ case Table::Field::INTEGER:
1345+ destination.append(" INT", 4);
1346+ break;
1347+ case Table::Field::BIGINT:
1348+ destination.append(" BIGINT", 7);
1349+ break;
1350+ case Table::Field::DECIMAL:
1351+ {
1352+ destination.append(" DECIMAL(", 9);
1353+ stringstream ss;
1354+ ss << field.numeric_options().precision() << ",";
1355+ ss << field.numeric_options().scale() << ")";
1356+ destination.append(ss.str());
1357+ }
1358+ break;
1359+ case Table::Field::DATE:
1360+ destination.append(" DATE", 5);
1361+ break;
1362+ case Table::Field::TIMESTAMP:
1363+ destination.append(" TIMESTAMP", 10);
1364+ break;
1365+ case Table::Field::DATETIME:
1366+ destination.append(" DATETIME", 9);
1367+ break;
1368+ }
1369+
1370+ if (field.type() == Table::Field::INTEGER ||
1371+ field.type() == Table::Field::BIGINT)
1372+ {
1373+ if (field.has_constraints() &&
1374+ field.constraints().has_is_unsigned() &&
1375+ field.constraints().is_unsigned())
1376+ {
1377+ destination.append(" UNSIGNED", 9);
1378+ }
1379+ }
1380+
1381+
1382+ if (! (field.has_constraints() &&
1383+ field.constraints().is_nullable()))
1384+ {
1385+ destination.append(" NOT", 4);
1386+ }
1387+ destination.append(" NULL", 5);
1388+
1389+ if (field.type() == Table::Field::INTEGER ||
1390+ field.type() == Table::Field::BIGINT)
1391+ {
1392+ /* AUTO_INCREMENT must be after NOT NULL */
1393+ if (field.has_numeric_options() &&
1394+ field.numeric_options().is_autoincrement())
1395+ {
1396+ destination.append(" AUTO_INCREMENT", 15);
1397+ }
1398+ }
1399+
1400+ if (field.type() == Table::Field::BLOB ||
1401+ field.type() == Table::Field::VARCHAR)
1402+ {
1403+ if (field.string_options().has_collation())
1404+ {
1405+ destination.append(" COLLATE ", 9);
1406+ destination.append(field.string_options().collation());
1407+ }
1408+ }
1409+
1410+ if (field.options().has_default_value())
1411+ {
1412+ destination.append(" DEFAULT ", 9);
1413+ destination.push_back(quoted_identifier);
1414+ destination.append(field.options().default_value());
1415+ destination.push_back(quoted_identifier);
1416+ }
1417+
1418+ if (field.options().has_default_bin_value())
1419+ {
1420+ const string &v= field.options().default_bin_value();
1421+ destination.append(" DEFAULT 0x", 11);
1422+ for (size_t x= 0; x < v.length(); x++)
1423+ {
1424+ printf("%.2x", *(v.c_str() + x));
1425+ }
1426+ }
1427+
1428+ if (field.type() == Table::Field::TIMESTAMP)
1429+ if (field.timestamp_options().has_auto_updates() &&
1430+ field.timestamp_options().auto_updates())
1431+ destination.append(" ON UPDATE CURRENT_TIMESTAMP", 28);
1432+
1433+ if (field.has_comment())
1434+ {
1435+ destination.append(" COMMENT ", 9);
1436+ destination.push_back(quoted_identifier);
1437+ destination.append(field.comment());
1438+ destination.push_back(quoted_identifier);
1439+ }
1440+ return NONE;
1441+}
1442+
1443+bool shouldQuoteFieldValue(Table::Field::FieldType in_type)
1444 {
1445 switch (in_type)
1446 {
1447- case message::Table::Field::DOUBLE:
1448- case message::Table::Field::DECIMAL:
1449- case message::Table::Field::INTEGER:
1450- case message::Table::Field::BIGINT:
1451- case message::Table::Field::ENUM:
1452+ case Table::Field::DOUBLE:
1453+ case Table::Field::DECIMAL:
1454+ case Table::Field::INTEGER:
1455+ case Table::Field::BIGINT:
1456+ case Table::Field::ENUM:
1457 return false;
1458 default:
1459 return true;
1460 }
1461 }
1462
1463-drizzled::message::Table::Field::FieldType message::internalFieldTypeToFieldProtoType(enum enum_field_types type)
1464+Table::Field::FieldType internalFieldTypeToFieldProtoType(enum enum_field_types type)
1465 {
1466 switch (type) {
1467 case DRIZZLE_TYPE_LONG:
1468- return message::Table::Field::INTEGER;
1469+ return Table::Field::INTEGER;
1470 case DRIZZLE_TYPE_DOUBLE:
1471- return message::Table::Field::DOUBLE;
1472+ return Table::Field::DOUBLE;
1473 case DRIZZLE_TYPE_NULL:
1474 assert(false); /* Not a user definable type */
1475- return message::Table::Field::INTEGER; /* unreachable */
1476+ return Table::Field::INTEGER; /* unreachable */
1477 case DRIZZLE_TYPE_TIMESTAMP:
1478- return message::Table::Field::TIMESTAMP;
1479+ return Table::Field::TIMESTAMP;
1480 case DRIZZLE_TYPE_LONGLONG:
1481- return message::Table::Field::BIGINT;
1482+ return Table::Field::BIGINT;
1483 case DRIZZLE_TYPE_DATETIME:
1484- return message::Table::Field::DATETIME;
1485+ return Table::Field::DATETIME;
1486 case DRIZZLE_TYPE_DATE:
1487- return message::Table::Field::DATE;
1488+ return Table::Field::DATE;
1489 case DRIZZLE_TYPE_VARCHAR:
1490- return message::Table::Field::VARCHAR;
1491+ return Table::Field::VARCHAR;
1492 case DRIZZLE_TYPE_DECIMAL:
1493- return message::Table::Field::DECIMAL;
1494+ return Table::Field::DECIMAL;
1495 case DRIZZLE_TYPE_ENUM:
1496- return message::Table::Field::ENUM;
1497+ return Table::Field::ENUM;
1498 case DRIZZLE_TYPE_BLOB:
1499- return message::Table::Field::BLOB;
1500+ return Table::Field::BLOB;
1501 }
1502
1503 assert(false);
1504- return message::Table::Field::INTEGER; /* unreachable */
1505+ return Table::Field::INTEGER; /* unreachable */
1506 }
1507
1508+} /* namespace message */
1509 } /* namespace drizzled */
1510
1511=== modified file 'drizzled/message/statement_transform.h'
1512--- drizzled/message/statement_transform.h 2010-02-08 01:10:03 +0000
1513+++ drizzled/message/statement_transform.h 2010-03-02 21:04:16 +0000
1514@@ -2,10 +2,11 @@
1515 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
1516 *
1517 * Copyright (C) 2009 Sun Microsystems
1518+ * Copyright (c) 2010 Jay Pipes <jayjpipes@gmail.com>
1519 *
1520 * Authors:
1521 *
1522- * Jay Pipes <joinfu@sun.com>
1523+ * Jay Pipes <jaypipes@gmail.com>
1524 *
1525 * This program is free software; you can redistribute it and/or modify
1526 * it under the terms of the GNU General Public License as published by
1527@@ -52,7 +53,11 @@
1528 class DeleteHeader;
1529 class DeleteData;
1530 class DeleteRecord;
1531+class DropTableStatement;
1532+class CreateTableStatement;
1533 class TruncateTableStatement;
1534+class CreateSchemaStatement;
1535+class DropSchemaStatement;
1536 class SetVariableStatement;
1537
1538 /** A Variation of SQL to be output during transformation */
1539@@ -117,7 +122,7 @@
1540 enum TransformSqlError
1541 transformInsertStatementToSql(const InsertHeader &header,
1542 const InsertData &data,
1543- std::string *destination,
1544+ std::string &destination,
1545 enum TransformSqlVariant sql_variant= DRIZZLE);
1546
1547 /**
1548@@ -138,7 +143,7 @@
1549 enum TransformSqlError
1550 transformInsertRecordToSql(const InsertHeader &header,
1551 const InsertRecord &record,
1552- std::string *destination,
1553+ std::string &destination,
1554 enum TransformSqlVariant sql_variant= DRIZZLE);
1555
1556 /**
1557@@ -156,7 +161,7 @@
1558 */
1559 enum TransformSqlError
1560 transformInsertHeaderToSql(const InsertHeader &header,
1561- std::string *destination,
1562+ std::string &destination,
1563 enum TransformSqlVariant sql_variant= DRIZZLE);
1564
1565 /**
1566@@ -174,7 +179,7 @@
1567 */
1568 enum TransformSqlError
1569 transformUpdateHeaderToSql(const UpdateHeader &header,
1570- std::string *destination,
1571+ std::string &destination,
1572 enum TransformSqlVariant sql_variant= DRIZZLE);
1573
1574 /**
1575@@ -195,7 +200,7 @@
1576 enum TransformSqlError
1577 transformUpdateRecordToSql(const UpdateHeader &header,
1578 const UpdateRecord &record,
1579- std::string *destination,
1580+ std::string &destination,
1581 enum TransformSqlVariant sql_variant= DRIZZLE);
1582
1583 /**
1584@@ -221,7 +226,7 @@
1585 enum TransformSqlError
1586 transformDeleteStatementToSql(const DeleteHeader &header,
1587 const DeleteData &data,
1588- std::string *destination,
1589+ std::string &destination,
1590 enum TransformSqlVariant sql_variant= DRIZZLE);
1591
1592 /**
1593@@ -242,7 +247,7 @@
1594 enum TransformSqlError
1595 transformDeleteRecordToSql(const DeleteHeader &header,
1596 const DeleteRecord &record,
1597- std::string *destination,
1598+ std::string &destination,
1599 enum TransformSqlVariant sql_variant= DRIZZLE);
1600
1601 /**
1602@@ -260,10 +265,29 @@
1603 */
1604 enum TransformSqlError
1605 transformDeleteHeaderToSql(const DeleteHeader &header,
1606- std::string *destination,
1607+ std::string &destination,
1608 enum TransformSqlVariant sql_variant= DRIZZLE);
1609
1610 /**
1611+ * This function looks at a supplied DropTableStatement
1612+ * and constructs a correctly-formatted SQL
1613+ * statement to the supplied destination string.
1614+ *
1615+ * @param DropTableStatement message to transform
1616+ * @param Destination string to append SQL to
1617+ * @param Variation of SQL to generate
1618+ *
1619+ * @retval
1620+ * NONE if successful transformation
1621+ * @retval
1622+ * Error code (see enum TransformSqlError definition) if failure
1623+ */
1624+enum TransformSqlError
1625+transformDropTableStatementToSql(const DropTableStatement &statement,
1626+ std::string &destination,
1627+ enum TransformSqlVariant sql_variant= DRIZZLE);
1628+
1629+/**
1630 * This function looks at a supplied TruncateTableStatement
1631 * and constructs a correctly-formatted SQL
1632 * statement to the supplied destination string.
1633@@ -279,10 +303,48 @@
1634 */
1635 enum TransformSqlError
1636 transformTruncateTableStatementToSql(const TruncateTableStatement &statement,
1637- std::string *destination,
1638+ std::string &destination,
1639 enum TransformSqlVariant sql_variant= DRIZZLE);
1640
1641 /**
1642+ * This function looks at a supplied CreateSchemaStatement
1643+ * and constructs a correctly-formatted SQL
1644+ * statement to the supplied destination string.
1645+ *
1646+ * @param CreateSchemaStatement message to transform
1647+ * @param Destination string to append SQL to
1648+ * @param Variation of SQL to generate
1649+ *
1650+ * @retval
1651+ * NONE if successful transformation
1652+ * @retval
1653+ * Error code (see enum TransformSqlError definition) if failure
1654+ */
1655+enum TransformSqlError
1656+transformCreateSchemaStatementToSql(const CreateSchemaStatement &statement,
1657+ std::string &destination,
1658+ enum TransformSqlVariant sql_variant= DRIZZLE);
1659+
1660+/**
1661+ * This function looks at a supplied DropSchemaStatement
1662+ * and constructs a correctly-formatted SQL
1663+ * statement to the supplied destination string.
1664+ *
1665+ * @param DropSchemaStatement message to transform
1666+ * @param Destination string to append SQL to
1667+ * @param Variation of SQL to generate
1668+ *
1669+ * @retval
1670+ * NONE if successful transformation
1671+ * @retval
1672+ * Error code (see enum TransformSqlError definition) if failure
1673+ */
1674+enum TransformSqlError
1675+transformDropSchemaStatementToSql(const DropSchemaStatement &statement,
1676+ std::string &destination,
1677+ enum TransformSqlVariant sql_variant= DRIZZLE);
1678+
1679+/**
1680 * This function looks at a supplied SetVariableStatement
1681 * and constructs a correctly-formatted SQL
1682 * statement to the supplied destination string.
1683@@ -298,9 +360,95 @@
1684 */
1685 enum TransformSqlError
1686 transformSetVariableStatementToSql(const SetVariableStatement &statement,
1687- std::string *destination,
1688- enum TransformSqlVariant sql_variant= DRIZZLE);
1689-
1690+ std::string &destination,
1691+ enum TransformSqlVariant sql_variant= DRIZZLE);
1692+
1693+/**
1694+ * Appends to supplied string an SQL expression
1695+ * containing the supplied CreateTableStatement's
1696+ * appropriate CREATE TABLE SQL statement.
1697+ */
1698+enum TransformSqlError
1699+transformCreateTableStatementToSql(const CreateTableStatement &statement,
1700+ std::string &destination,
1701+ enum TransformSqlVariant sql_variant= DRIZZLE);
1702+
1703+/**
1704+ * Appends to the supplied string an SQL expression
1705+ * representing the table for a CREATE TABLE expression.
1706+ *
1707+ * @param[in] Table message
1708+ * @param[out] String to append to
1709+ *
1710+ * @retval
1711+ * NONE if successful transformation
1712+ * @retval
1713+ * Error code (see enum TransformSqlError definition) if failure
1714+ */
1715+enum TransformSqlError
1716+transformTableDefinitionToSql(const Table &table,
1717+ std::string &destination,
1718+ enum TransformSqlVariant sql_variant= DRIZZLE);
1719+
1720+/**
1721+ * Appends to the supplied string an SQL expression
1722+ * representing the table's optional attributes.
1723+ *
1724+ * @note
1725+ *
1726+ * This function will eventually be a much simpler
1727+ * listing of key/value pairs.
1728+ *
1729+ * @param[in] TableOptions message
1730+ * @param[out] String to append to
1731+ *
1732+ * @retval
1733+ * NONE if successful transformation
1734+ * @retval
1735+ * Error code (see enum TransformSqlError definition) if failure
1736+ */
1737+enum TransformSqlError
1738+transformTableOptionsToSql(const Table::TableOptions &table_options,
1739+ std::string &destination,
1740+ enum TransformSqlVariant sql_variant= DRIZZLE);
1741+
1742+/**
1743+ * Appends to the supplied string an SQL expression
1744+ * representing the index's attributes. The built string
1745+ * corresponds to the SQL in a CREATE INDEX statement.
1746+ *
1747+ * @param[in] Index message
1748+ * @param[in] Table containing this index (used to get field names...)
1749+ * @param[out] String to append to
1750+ *
1751+ * @retval
1752+ * NONE if successful transformation
1753+ * @retval
1754+ * Error code (see enum TransformSqlError definition) if failure
1755+ */
1756+enum TransformSqlError
1757+transformIndexDefinitionToSql(const Table::Index &index,
1758+ const Table &table,
1759+ std::string &destination,
1760+ enum TransformSqlVariant sql_variant= DRIZZLE);
1761+
1762+/**
1763+ * Appends to the supplied string an SQL expression
1764+ * representing the field's attributes. The built string
1765+ * corresponds to the SQL in a CREATE TABLE statement.
1766+ *
1767+ * @param[in] Field message
1768+ * @param[out] String to append to
1769+ *
1770+ * @retval
1771+ * NONE if successful transformation
1772+ * @retval
1773+ * Error code (see enum TransformSqlError definition) if failure
1774+ */
1775+enum TransformSqlError
1776+transformFieldDefinitionToSql(const Table::Field &field,
1777+ std::string &destination,
1778+ enum TransformSqlVariant sql_variant= DRIZZLE);
1779
1780 /**
1781 * Returns true if the supplied message::Table::Field::FieldType
1782
1783=== modified file 'drizzled/message/table.proto'
1784--- drizzled/message/table.proto 2010-02-16 01:28:56 +0000
1785+++ drizzled/message/table.proto 2010-03-02 21:04:16 +0000
1786@@ -157,7 +157,7 @@
1787
1788 message IndexPart {
1789 required uint32 fieldnr = 1;
1790- optional int32 compare_length = 2;
1791+ optional uint32 compare_length = 2;
1792 optional bool in_reverse_order = 3 [default = false];
1793
1794 optional uint32 key_type = 101; /* THIS MUST DIE. Along with pack_flag*/
1795
1796=== modified file 'drizzled/message/table_reader.cc'
1797--- drizzled/message/table_reader.cc 2010-02-16 01:28:56 +0000
1798+++ drizzled/message/table_reader.cc 2010-03-02 21:04:16 +0000
1799@@ -30,7 +30,7 @@
1800
1801 #include <iostream>
1802 #include <string>
1803-#include <drizzled/message/table.pb.h>
1804+#include <drizzled/message/statement_transform.h>
1805 #include <google/protobuf/io/zero_copy_stream.h>
1806 #include <google/protobuf/io/zero_copy_stream_impl.h>
1807
1808@@ -42,246 +42,6 @@
1809 Written from Google proto example
1810 */
1811
1812-static void print_field(const message::Table::Field &field)
1813-{
1814- cout << "\t`" << field.name() << "`";
1815-
1816- message::Table::Field::FieldType field_type= field.type();
1817-
1818- switch (field_type)
1819- {
1820- case message::Table::Field::DOUBLE:
1821- cout << " DOUBLE ";
1822- break;
1823- case message::Table::Field::VARCHAR:
1824- cout << " VARCHAR(" << field.string_options().length() << ")";
1825- break;
1826- case message::Table::Field::BLOB:
1827- cout << " BLOB "; /* FIXME: or text, depends on collation */
1828- if(field.string_options().has_collation_id())
1829- cout << "COLLATION=" << field.string_options().collation_id() << " ";
1830- break;
1831- case message::Table::Field::ENUM:
1832- {
1833- int x;
1834-
1835- cout << " ENUM(";
1836- for (x= 0; x < field.set_options().field_value_size() ; x++)
1837- {
1838- const string type= field.set_options().field_value(x);
1839-
1840- if (x != 0)
1841- cout << ",";
1842- cout << "'" << type << "'";
1843- }
1844- cout << ") ";
1845- break;
1846- }
1847- case message::Table::Field::INTEGER:
1848- cout << " INT" ;
1849- break;
1850- case message::Table::Field::BIGINT:
1851- cout << " BIGINT ";
1852- break;
1853- case message::Table::Field::DECIMAL:
1854- cout << " DECIMAL(" << field.numeric_options().precision() << "," << field.numeric_options().scale() << ") ";
1855- break;
1856- case message::Table::Field::DATE:
1857- cout << " DATE ";
1858- break;
1859- case message::Table::Field::TIMESTAMP:
1860- cout << " TIMESTAMP ";
1861- break;
1862- case message::Table::Field::DATETIME:
1863- cout << " DATETIME ";
1864- break;
1865- }
1866-
1867- if (field.type() == message::Table::Field::INTEGER
1868- || field.type() == message::Table::Field::BIGINT)
1869- {
1870- if (field.has_constraints()
1871- && field.constraints().has_is_unsigned())
1872- if (field.constraints().is_unsigned())
1873- cout << " UNSIGNED";
1874-
1875- if (field.has_numeric_options() &&
1876- field.numeric_options().is_autoincrement())
1877- cout << " AUTOINCREMENT ";
1878- }
1879-
1880- if (!( field.has_constraints()
1881- && field.constraints().is_nullable()))
1882- cout << " NOT NULL ";
1883-
1884- if (field.type() == message::Table::Field::BLOB
1885- || field.type() == message::Table::Field::VARCHAR)
1886- {
1887- if (field.string_options().has_collation())
1888- cout << " COLLATE " << field.string_options().collation();
1889- }
1890-
1891- if (field.options().has_default_value())
1892- cout << " DEFAULT `" << field.options().default_value() << "` " ;
1893-
1894- if (field.options().has_default_bin_value())
1895- {
1896- string v= field.options().default_bin_value();
1897- cout << " DEFAULT 0x";
1898- for(unsigned int i=0; i< v.length(); i++)
1899- {
1900- printf("%.2x", *(v.c_str()+i));
1901- }
1902- }
1903-
1904- if (field.type() == message::Table::Field::TIMESTAMP)
1905- if (field.timestamp_options().has_auto_updates()
1906- && field.timestamp_options().auto_updates())
1907- cout << " ON UPDATE CURRENT_TIMESTAMP";
1908-
1909- if (field.has_comment())
1910- cout << " COMMENT `" << field.comment() << "` ";
1911-}
1912-
1913-static void print_engine(const message::Table::StorageEngine &engine)
1914-{
1915- int32_t x;
1916-
1917- cout << " ENGINE = " << engine.name() << endl;
1918-
1919- for (x= 0; x < engine.option_size(); ++x) {
1920- const message::Table::StorageEngine::EngineOption option= engine.option(x);
1921- cout << "\t" << option.option_name() << " = "
1922- << option.option_value() << endl;
1923- }
1924-}
1925-
1926-static void print_index(const message::Table::Index &index)
1927-{
1928-
1929- if (index.is_primary())
1930- cout << " PRIMARY";
1931- else if (index.is_unique())
1932- cout << " UNIQUE";
1933- cout << " KEY `" << index.name() << "` (";
1934- {
1935- int32_t x;
1936-
1937- for (x= 0; x < index.index_part_size() ; x++)
1938- {
1939- const message::Table::Index::IndexPart part= index.index_part(x);
1940-
1941- if (x != 0)
1942- cout << ",";
1943- cout << "`" << part.fieldnr() << "`"; /* FIXME */
1944- if (part.has_compare_length())
1945- cout << "(" << part.compare_length() << ")";
1946- }
1947- cout << ")";
1948- }
1949- cout << "\t";
1950-}
1951-
1952-static void print_table_options(const message::Table::TableOptions &options)
1953-{
1954- if (options.has_comment())
1955- cout << " COMMENT = '" << options.comment() << "' " << endl;
1956-
1957- if (options.has_collation())
1958- cout << " COLLATE = '" << options.collation() << "' " << endl;
1959-
1960- if (options.has_auto_increment())
1961- cout << " AUTOINCREMENT_OFFSET = " << options.auto_increment() << endl;
1962-
1963- if (options.has_collation_id())
1964- cout << "-- collation_id = " << options.collation_id() << endl;
1965-
1966- if (options.has_row_type())
1967- cout << " ROW_TYPE = " << options.row_type() << endl;
1968-
1969- if (options.has_data_file_name())
1970- cout << " DATA_FILE_NAME = '" << options.data_file_name() << "'" << endl;
1971-
1972- if (options.has_index_file_name())
1973- cout << " INDEX_FILE_NAME = '" << options.index_file_name() << "'" << endl;
1974-
1975- if (options.has_max_rows())
1976- cout << " MAX_ROWS = " << options.max_rows() << endl;
1977-
1978- if (options.has_min_rows())
1979- cout << " MIN_ROWS = " << options.min_rows() << endl;
1980-
1981- if (options.has_auto_increment_value())
1982- cout << " AUTO_INCREMENT = " << options.auto_increment_value() << endl;
1983-
1984- if (options.has_avg_row_length())
1985- cout << " AVG_ROW_LENGTH = " << options.avg_row_length() << endl;
1986-
1987- if (options.has_key_block_size())
1988- cout << " KEY_BLOCK_SIZE = " << options.key_block_size() << endl;
1989-
1990- if (options.has_block_size())
1991- cout << " BLOCK_SIZE = " << options.block_size() << endl;
1992-
1993- if (options.has_comment())
1994- cout << " COMMENT = '" << options.comment() << "'" << endl;
1995-
1996- if (options.has_pack_keys())
1997- cout << " PACK_KEYS = " << options.pack_keys() << endl;
1998- if (options.has_pack_record())
1999- cout << " PACK_RECORD = " << options.pack_record() << endl;
2000- if (options.has_checksum())
2001- cout << " CHECKSUM = " << options.checksum() << endl;
2002- if (options.has_page_checksum())
2003- cout << " PAGE_CHECKSUM = " << options.page_checksum() << endl;
2004-}
2005-
2006-
2007-static void print_table(const message::Table &table)
2008-{
2009- int32_t x;
2010-
2011- cout << "CREATE ";
2012-
2013- if (table.type() == message::Table::TEMPORARY)
2014- cout << "TEMPORARY ";
2015-
2016- cout << "TABLE `" << table.name() << "` (" << endl;
2017-
2018- for (x= 0; x < table.field_size() ; x++)
2019- {
2020- const message::Table::Field field = table.field(x);
2021-
2022- if (x != 0)
2023- cout << "," << endl;
2024-
2025- print_field(field);
2026- }
2027-
2028- for (x= 0; x < table.indexes_size() ; x++)
2029- {
2030- const message::Table::Index index= table.indexes(x);
2031-
2032- if (x != 0)
2033- cout << "," << endl;;
2034-
2035- print_index(index);
2036-
2037- }
2038- cout << endl;
2039-
2040- cout << ") " << endl;
2041-
2042- print_engine(table.engine());
2043-
2044- if (table.has_options())
2045- print_table_options(table.options());
2046- /*
2047- if (table->has_stats())
2048- print_table_stats(&table->stats());
2049- */
2050-}
2051-
2052 int main(int argc, char* argv[])
2053 {
2054 GOOGLE_PROTOBUF_VERIFY_VERSION;
2055@@ -315,7 +75,10 @@
2056 close(fd);
2057 }
2058
2059- print_table(table);
2060+ string output;
2061+ (void) message::transformTableDefinitionToSql(table, output);
2062+
2063+ cout << output << endl;
2064
2065 return 0;
2066 }
2067
2068=== modified file 'drizzled/message/transaction.proto'
2069--- drizzled/message/transaction.proto 2009-11-03 18:49:13 +0000
2070+++ drizzled/message/transaction.proto 2010-03-02 21:04:16 +0000
2071@@ -499,6 +499,7 @@
2072 message DropTableStatement
2073 {
2074 required TableMetadata table_metadata = 1; /* Minimal metadata about the table to be dropped */
2075+ optional bool if_exists_clause = 2; /* Did the user specify an IF EXISTS clause? */
2076 }
2077
2078 /*
2079
2080=== modified file 'drizzled/replication_services.cc'
2081--- drizzled/replication_services.cc 2010-02-11 03:49:10 +0000
2082+++ drizzled/replication_services.cc 2010-03-02 21:04:16 +0000
2083@@ -508,7 +508,7 @@
2084 * We add the "key field metadata" -- i.e. the fields which is
2085 * the primary key for the table.
2086 */
2087- if (in_table->s->primary_key == current_field->field_index)
2088+ if (in_table->s->fieldInPrimaryKey(current_field))
2089 {
2090 field_metadata= header->add_key_field_metadata();
2091 field_metadata->set_name(current_field->field_name);
2092@@ -602,7 +602,7 @@
2093 * primary key field value. Replication only supports tables
2094 * with a primary key.
2095 */
2096- if (in_table->s->primary_key == current_field->field_index)
2097+ if (in_table->s->fieldInPrimaryKey(current_field))
2098 {
2099 /**
2100 * To say the below is ugly is an understatement. But it works.
2101@@ -682,7 +682,7 @@
2102 * primary key field value. Replication only supports tables
2103 * with a primary key.
2104 */
2105- if (in_table->s->primary_key == current_field->field_index)
2106+ if (in_table->s->fieldInPrimaryKey(current_field))
2107 {
2108 field_metadata= header->add_key_field_metadata();
2109 field_metadata->set_name(current_field->field_name);
2110@@ -715,7 +715,7 @@
2111 * primary key field value. Replication only supports tables
2112 * with a primary key.
2113 */
2114- if (in_table->s->primary_key == current_field->field_index)
2115+ if (in_table->s->fieldInPrimaryKey(current_field))
2116 {
2117 string_value= current_field->val_str(string_value);
2118 record->add_key_value(string_value->c_ptr(), string_value->length());
2119@@ -727,6 +727,126 @@
2120 }
2121 }
2122
2123+void ReplicationServices::createTable(Session *in_session,
2124+ const message::Table &table)
2125+{
2126+ if (! is_active)
2127+ return;
2128+
2129+ message::Transaction *transaction= getActiveTransaction(in_session);
2130+ message::Statement *statement= transaction->add_statement();
2131+
2132+ initStatement(*statement, message::Statement::CREATE_TABLE, in_session);
2133+
2134+ /*
2135+ * Construct the specialized CreateTableStatement message and attach
2136+ * it to the generic Statement message
2137+ */
2138+ message::CreateTableStatement *create_table_statement= statement->mutable_create_table_statement();
2139+ message::Table *new_table_message= create_table_statement->mutable_table();
2140+ *new_table_message= table;
2141+
2142+ finalizeStatement(*statement, in_session);
2143+
2144+ finalizeTransaction(*transaction, in_session);
2145+
2146+ push(*transaction);
2147+
2148+ cleanupTransaction(transaction, in_session);
2149+
2150+}
2151+
2152+void ReplicationServices::createSchema(Session *in_session,
2153+ const message::Schema &schema)
2154+{
2155+ if (! is_active)
2156+ return;
2157+
2158+ message::Transaction *transaction= getActiveTransaction(in_session);
2159+ message::Statement *statement= transaction->add_statement();
2160+
2161+ initStatement(*statement, message::Statement::CREATE_SCHEMA, in_session);
2162+
2163+ /*
2164+ * Construct the specialized CreateSchemaStatement message and attach
2165+ * it to the generic Statement message
2166+ */
2167+ message::CreateSchemaStatement *create_schema_statement= statement->mutable_create_schema_statement();
2168+ message::Schema *new_schema_message= create_schema_statement->mutable_schema();
2169+ *new_schema_message= schema;
2170+
2171+ finalizeStatement(*statement, in_session);
2172+
2173+ finalizeTransaction(*transaction, in_session);
2174+
2175+ push(*transaction);
2176+
2177+ cleanupTransaction(transaction, in_session);
2178+
2179+}
2180+
2181+void ReplicationServices::dropSchema(Session *in_session, const string &schema_name)
2182+{
2183+ if (! is_active)
2184+ return;
2185+
2186+ message::Transaction *transaction= getActiveTransaction(in_session);
2187+ message::Statement *statement= transaction->add_statement();
2188+
2189+ initStatement(*statement, message::Statement::DROP_SCHEMA, in_session);
2190+
2191+ /*
2192+ * Construct the specialized DropSchemaStatement message and attach
2193+ * it to the generic Statement message
2194+ */
2195+ message::DropSchemaStatement *drop_schema_statement= statement->mutable_drop_schema_statement();
2196+
2197+ drop_schema_statement->set_schema_name(schema_name);
2198+
2199+ finalizeStatement(*statement, in_session);
2200+
2201+ finalizeTransaction(*transaction, in_session);
2202+
2203+ push(*transaction);
2204+
2205+ cleanupTransaction(transaction, in_session);
2206+}
2207+
2208+void ReplicationServices::dropTable(Session *in_session,
2209+ const string &schema_name,
2210+ const string &table_name,
2211+ bool if_exists)
2212+{
2213+ if (! is_active)
2214+ return;
2215+
2216+ message::Transaction *transaction= getActiveTransaction(in_session);
2217+ message::Statement *statement= transaction->add_statement();
2218+
2219+ initStatement(*statement, message::Statement::DROP_TABLE, in_session);
2220+
2221+ /*
2222+ * Construct the specialized DropTableStatement message and attach
2223+ * it to the generic Statement message
2224+ */
2225+ message::DropTableStatement *drop_table_statement= statement->mutable_drop_table_statement();
2226+
2227+ drop_table_statement->set_if_exists_clause(if_exists);
2228+
2229+ message::TableMetadata *table_metadata= drop_table_statement->mutable_table_metadata();
2230+
2231+ table_metadata->set_schema_name(schema_name);
2232+ table_metadata->set_table_name(table_name);
2233+
2234+ finalizeStatement(*statement, in_session);
2235+
2236+ finalizeTransaction(*transaction, in_session);
2237+
2238+ push(*transaction);
2239+
2240+ cleanupTransaction(transaction, in_session);
2241+}
2242+
2243 void ReplicationServices::truncateTable(Session *in_session, Table *in_table)
2244 {
2245 if (! is_active)
2246
2247=== modified file 'drizzled/replication_services.h'
2248--- drizzled/replication_services.h 2010-02-11 03:29:52 +0000
2249+++ drizzled/replication_services.h 2010-03-02 21:04:16 +0000
2250@@ -2,10 +2,11 @@
2251 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
2252 *
2253 * Copyright (C) 2008-2009 Sun Microsystems
2254+ * Copyright (c) 2009-2010 Jay Pipes <jaypipes@gmail.com>
2255 *
2256 * Authors:
2257 *
2258- * Jay Pipes <joinfu@sun.com>
2259+ * Jay Pipes <jaypipes@gmail.com>
2260 *
2261 * This program is free software; you can redistribute it and/or modify
2262 * it under the terms of the GNU General Public License as published by
2263@@ -30,7 +31,6 @@
2264
2265 #include <vector>
2266
2267-
2268 namespace drizzled
2269 {
2270
2271@@ -323,7 +323,48 @@
2272 */
2273 void deleteRecord(Session *in_session, Table *in_table);
2274 /**
2275- * Creates a TruncateTable Statement GPB message and add it
2276+ * Creates a CreateSchema Statement GPB message and adds it
2277+ * to the Session's active Transaction GPB message for pushing
2278+ * out to the replicator streams.
2279+ *
2280+ * @param[in] Pointer to the Session which issued the statement
2281+ * @param[in] message::Schema message describing new schema
2282+ */
2283+ void createSchema(Session *in_session, const message::Schema &schema);
2284+ /**
2285+ * Creates a DropSchema Statement GPB message and adds it
2286+ * to the Session's active Transaction GPB message for pushing
2287+ * out to the replicator streams.
2288+ *
2289+ * @param[in] Pointer to the Session which issued the statement
2290+ * @param[in] message::Schema message describing new schema
2291+ */
2292+ void dropSchema(Session *in_session, const std::string &schema_name);
2293+ /**
2294+ * Creates a CreateTable Statement GPB message and adds it
2295+ * to the Session's active Transaction GPB message for pushing
2296+ * out to the replicator streams.
2297+ *
2298+ * @param[in] Pointer to the Session which issued the statement
2299+ * @param[in] message::Table message describing new schema
2300+ */
2301+ void createTable(Session *in_session, const message::Table &table);
2302+ /**
2303+ * Creates a DropTable Statement GPB message and adds it
2304+ * to the Session's active Transaction GPB message for pushing
2305+ * out to the replicator streams.
2306+ *
2307+ * @param[in] Pointer to the Session which issued the statement
2308+ * @param[in] The schema of the table being dropped
2309+ * @param[in] The table name of the table being dropped
2310+ * @param[in] Did the user specify an IF EXISTS clause?
2311+ */
2312+ void dropTable(Session *in_session,
2313+ const std::string &schema_name,
2314+ const std::string &table_name,
2315+ bool if_exists);
2316+ /**
2317+ * Creates a TruncateTable Statement GPB message and adds it
2318 * to the Session's active Transaction GPB message for pushing
2319 * out to the replicator streams.
2320 *
2321
2322=== modified file 'drizzled/sql_insert.cc'
2323--- drizzled/sql_insert.cc 2010-02-14 20:26:43 +0000
2324+++ drizzled/sql_insert.cc 2010-03-02 21:04:16 +0000
2325@@ -1615,32 +1615,17 @@
2326
2327 DRIZZLE_LOCK *extra_lock= NULL;
2328 /*
2329- For row-based replication, the CREATE-SELECT statement is written
2330- in two pieces: the first one contain the CREATE TABLE statement
2331- necessary to create the table and the second part contain the rows
2332- that should go into the table.
2333-
2334- For non-temporary tables, the start of the CREATE-SELECT
2335- implicitly commits the previous transaction, and all events
2336- forming the statement will be stored the transaction cache. At end
2337- of the statement, the entire statement is committed as a
2338- transaction, and all events are written to the binary log.
2339-
2340- On the master, the table is locked for the duration of the
2341- statement, but since the CREATE part is replicated as a simple
2342- statement, there is no way to lock the table for accesses on the
2343- slave. Hence, we have to hold on to the CREATE part of the
2344- statement until the statement has finished.
2345+ For replication, the CREATE-SELECT statement is written
2346+ in two pieces: the first transaction messsage contains
2347+ the CREATE TABLE statement as a CreateTableStatement message
2348+ necessary to create the table.
2349+
2350+ The second transaction message contains all the InsertStatement
2351+ and associated InsertRecords that should go into the table.
2352 */
2353
2354 unit= u;
2355
2356- /*
2357- Start a statement transaction before the create if we are using
2358- row-based replication for the statement. If we are creating a
2359- temporary table, we need to start a statement transaction.
2360- */
2361-
2362 if (!(table= create_table_from_items(session, create_info, create_table,
2363 table_proto,
2364 alter_info, &values,
2365
2366=== modified file 'drizzled/sql_table.cc'
2367--- drizzled/sql_table.cc 2010-03-02 02:17:49 +0000
2368+++ drizzled/sql_table.cc 2010-03-02 21:04:16 +0000
2369@@ -54,6 +54,7 @@
2370 namespace drizzled
2371 {
2372
2373+extern plugin::StorageEngine *myisam_engine;
2374 extern pid_t current_pid;
2375
2376 bool is_primary_key(KEY *key_info)
2377@@ -249,7 +250,7 @@
2378
2379 if ((error == ENOENT || error == HA_ERR_NO_SUCH_TABLE) && if_exists)
2380 {
2381- error= 0;
2382+ error= 0;
2383 session->clear_error();
2384 }
2385
2386@@ -261,7 +262,10 @@
2387 }
2388
2389 if (error == 0 || (if_exists && foreign_key_error == false))
2390- write_bin_log_drop_table(session, if_exists, db, table->table_name);
2391+ {
2392+ ReplicationServices &replication_services= ReplicationServices::singleton();
2393+ replication_services.dropTable(session, string(db), string(table->table_name), if_exists);
2394+ }
2395
2396 if (error)
2397 {
2398@@ -757,9 +761,11 @@
2399 }
2400 }
2401 }
2402- /* Don't pack rows in old tables if the user has requested this */
2403- if ((sql_field->flags & BLOB_FLAG) ||
2404- (sql_field->sql_type == DRIZZLE_TYPE_VARCHAR && create_info->row_type != ROW_TYPE_FIXED))
2405+
2406+ /** @todo Get rid of this MyISAM-specific crap. */
2407+ if (create_info->db_type == myisam_engine &&
2408+ ((sql_field->flags & BLOB_FLAG) ||
2409+ (sql_field->sql_type == DRIZZLE_TYPE_VARCHAR && create_info->row_type != ROW_TYPE_FIXED)))
2410 (*db_options)|= HA_OPTION_PACK_RECORD;
2411 it2.rewind();
2412 }
2413@@ -1451,15 +1457,11 @@
2414 }
2415 }
2416
2417- /*
2418- Don't write statement if:
2419- - It is an internal temporary table,
2420- - Row-based logging is used and it we are creating a temporary table, or
2421- - The binary log is not open.
2422- Otherwise, the statement shall be binlogged.
2423- */
2424 if (not internal_tmp_table && not lex_identified_temp_table)
2425- write_bin_log(session, session->query.c_str());
2426+ {
2427+ ReplicationServices &replication_services= ReplicationServices::singleton();
2428+ replication_services.createTable(session, *table_proto);
2429+ }
2430 error= false;
2431 unlock_and_end:
2432 pthread_mutex_unlock(&LOCK_open);
2433
2434=== modified file 'drizzled/table_proto_write.cc'
2435--- drizzled/table_proto_write.cc 2010-02-24 00:18:38 +0000
2436+++ drizzled/table_proto_write.cc 2010-03-02 21:04:16 +0000
2437@@ -309,7 +309,7 @@
2438 switch(create_info->row_type)
2439 {
2440 case ROW_TYPE_DEFAULT:
2441- table_options->set_row_type(message::Table::TableOptions::ROW_TYPE_DEFAULT);
2442+ /* No use setting a default row type... just adds redundant info to message */
2443 break;
2444 case ROW_TYPE_FIXED:
2445 table_options->set_row_type(message::Table::TableOptions::ROW_TYPE_FIXED);
2446@@ -333,8 +333,8 @@
2447 abort();
2448 }
2449
2450- table_options->set_pack_record(create_info->table_options
2451- & HA_OPTION_PACK_RECORD);
2452+ if (create_info->table_options & HA_OPTION_PACK_RECORD)
2453+ table_options->set_pack_record(true);
2454
2455 if (table_options->has_comment())
2456 {
2457@@ -447,7 +447,10 @@
2458
2459 idx->set_comment(key_info[i].comment.str);
2460 }
2461- if(key_info[i].flags & ~(HA_NOSAME | HA_PACK_KEY | HA_USES_BLOCK_SIZE | HA_BINARY_PACK_KEY | HA_VAR_LENGTH_PART | HA_NULL_PART_KEY | HA_KEY_HAS_PART_KEY_SEG | HA_GENERATED_KEY | HA_USES_COMMENT))
2462+ if (key_info[i].flags &
2463+ ~(HA_NOSAME | HA_PACK_KEY | HA_USES_BLOCK_SIZE |
2464+ HA_BINARY_PACK_KEY | HA_VAR_LENGTH_PART | HA_NULL_PART_KEY |
2465+ HA_KEY_HAS_PART_KEY_SEG | HA_GENERATED_KEY | HA_USES_COMMENT))
2466 abort(); // Invalid (unknown) index flag.
2467
2468 for(unsigned int j=0; j< key_info[i].key_parts; j++)
2469
2470=== modified file 'drizzled/table_share.cc'
2471--- drizzled/table_share.cc 2010-02-04 08:14:46 +0000
2472+++ drizzled/table_share.cc 2010-03-02 21:04:16 +0000
2473@@ -273,4 +273,31 @@
2474 }
2475 }
2476
2477+/**
2478+ * @todo
2479+ *
2480+ * Precache this stuff....
2481+ */
2482+bool TableShare::fieldInPrimaryKey(Field *in_field) const
2483+{
2484+ assert(table_proto != NULL);
2485+
2486+ size_t num_indexes= table_proto->indexes_size();
2487+
2488+ for (size_t x= 0; x < num_indexes; ++x)
2489+ {
2490+ const message::Table::Index &index= table_proto->indexes(x);
2491+ if (index.is_primary())
2492+ {
2493+ size_t num_parts= index.index_part_size();
2494+ for (size_t y= 0; y < num_parts; ++y)
2495+ {
2496+ if (index.index_part(y).fieldnr() == in_field->field_index)
2497+ return true;
2498+ }
2499+ }
2500+ }
2501+ return false;
2502+}
2503+
2504 } /* namespace drizzled */
2505
2506=== modified file 'drizzled/table_share.h'
2507--- drizzled/table_share.h 2010-02-23 01:14:53 +0000
2508+++ drizzled/table_share.h 2010-03-02 21:04:16 +0000
2509@@ -260,6 +260,12 @@
2510 max_rows= arg;
2511 }
2512
2513+ /**
2514+ * Returns true if the supplied Field object
2515+ * is part of the table's primary key.
2516+ */
2517+ bool fieldInPrimaryKey(Field *field) const;
2518+
2519 plugin::StorageEngine *storage_engine; /* storage engine plugin */
2520 inline plugin::StorageEngine *db_type() const /* table_type for handler */
2521 {
2522
2523=== modified file 'plugin/transaction_log/tests/r/alter.result'
2524--- plugin/transaction_log/tests/r/alter.result 2009-12-23 14:24:22 +0000
2525+++ plugin/transaction_log/tests/r/alter.result 2010-03-02 21:04:16 +0000
2526@@ -10,10 +10,10 @@
2527 ALTER TABLE t1 ADD INDEX ix_padding (padding(20));
2528 DROP TABLE t1;
2529 START TRANSACTION;
2530-DROP TABLE IF EXISTS `t1`;
2531+DROP TABLE IF EXISTS `test`.`t1`;
2532 COMMIT;
2533 START TRANSACTION;
2534-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
2535+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2536 COMMIT;
2537 START TRANSACTION;
2538 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2539@@ -28,6 +28,6 @@
2540 ALTER TABLE t1 ADD INDEX ix_padding (padding(20));
2541 COMMIT;
2542 START TRANSACTION;
2543-DROP TABLE `t1`;
2544+DROP TABLE `test`.`t1`;
2545 COMMIT;
2546 SET GLOBAL transaction_log_truncate_debug= true;
2547
2548=== modified file 'plugin/transaction_log/tests/r/auto_commit.result'
2549--- plugin/transaction_log/tests/r/auto_commit.result 2009-12-23 14:24:22 +0000
2550+++ plugin/transaction_log/tests/r/auto_commit.result 2010-03-02 21:04:16 +0000
2551@@ -16,28 +16,28 @@
2552 INSERT INTO t1 VALUES (2, "I hate testing.");
2553 DROP TABLE t1;
2554 START TRANSACTION;
2555-DROP TABLE IF EXISTS `t1`;
2556-COMMIT;
2557-START TRANSACTION;
2558-CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );
2559-COMMIT;
2560-START TRANSACTION;
2561-INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2562-INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
2563-COMMIT;
2564-START TRANSACTION;
2565-DROP TABLE `t1`;
2566-COMMIT;
2567-START TRANSACTION;
2568-CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );
2569-COMMIT;
2570-START TRANSACTION;
2571-INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2572-COMMIT;
2573-START TRANSACTION;
2574-INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
2575-COMMIT;
2576-START TRANSACTION;
2577-DROP TABLE `t1`;
2578+DROP TABLE IF EXISTS `test`.`t1`;
2579+COMMIT;
2580+START TRANSACTION;
2581+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2582+COMMIT;
2583+START TRANSACTION;
2584+INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2585+INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
2586+COMMIT;
2587+START TRANSACTION;
2588+DROP TABLE `test`.`t1`;
2589+COMMIT;
2590+START TRANSACTION;
2591+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2592+COMMIT;
2593+START TRANSACTION;
2594+INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2595+COMMIT;
2596+START TRANSACTION;
2597+INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
2598+COMMIT;
2599+START TRANSACTION;
2600+DROP TABLE `test`.`t1`;
2601 COMMIT;
2602 SET GLOBAL transaction_log_truncate_debug= true;
2603
2604=== modified file 'plugin/transaction_log/tests/r/blob.result'
2605--- plugin/transaction_log/tests/r/blob.result 2009-12-23 14:24:22 +0000
2606+++ plugin/transaction_log/tests/r/blob.result 2010-03-02 21:04:16 +0000
2607@@ -10,10 +10,10 @@
2608 DELETE FROM t1 WHERE padding = 'test\0you';
2609 DROP TABLE t1;
2610 START TRANSACTION;
2611-DROP TABLE IF EXISTS `t1`;
2612+DROP TABLE IF EXISTS `test`.`t1`;
2613 COMMIT;
2614 START TRANSACTION;
2615-CREATE TABLE t1 ( id INT NOT NULL , padding BLOB NOT NULL , PRIMARY KEY (id) );
2616+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` BLOB NOT NULL COLLATE binary, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2617 COMMIT;
2618 START TRANSACTION;
2619 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'test\0me');
2620@@ -29,6 +29,6 @@
2621 DELETE FROM `test`.`t1` WHERE `id`=2;
2622 COMMIT;
2623 START TRANSACTION;
2624-DROP TABLE `t1`;
2625+DROP TABLE `test`.`t1`;
2626 COMMIT;
2627 SET GLOBAL transaction_log_truncate_debug= true;
2628
2629=== added file 'plugin/transaction_log/tests/r/create_schema.result'
2630--- plugin/transaction_log/tests/r/create_schema.result 1970-01-01 00:00:00 +0000
2631+++ plugin/transaction_log/tests/r/create_schema.result 2010-03-02 21:04:16 +0000
2632@@ -0,0 +1,13 @@
2633+DROP SCHEMA IF EXISTS my_new_schema;
2634+CREATE SCHEMA my_new_warnings;
2635+DROP SCHEMA my_new_warnings;
2636+START TRANSACTION;
2637+DROP SCHEMA IF EXISTS my_new_schema;
2638+COMMIT;
2639+START TRANSACTION;
2640+CREATE SCHEMA `my_new_warnings` COLLATE utf8_general_ci;
2641+COMMIT;
2642+START TRANSACTION;
2643+DROP SCHEMA my_new_warnings;
2644+COMMIT;
2645+SET GLOBAL transaction_log_truncate_debug= true;
2646
2647=== modified file 'plugin/transaction_log/tests/r/create_select.result'
2648--- plugin/transaction_log/tests/r/create_select.result 2009-12-23 14:24:22 +0000
2649+++ plugin/transaction_log/tests/r/create_select.result 2010-03-02 21:04:16 +0000
2650@@ -12,13 +12,13 @@
2651 ) SELECT * FROM t1;
2652 DROP TABLE t1, t2;
2653 START TRANSACTION;
2654-DROP TABLE IF EXISTS `t1`;
2655-COMMIT;
2656-START TRANSACTION;
2657-DROP TABLE IF EXISTS `t2`;
2658-COMMIT;
2659-START TRANSACTION;
2660-CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );
2661+DROP TABLE IF EXISTS `test`.`t1`;
2662+COMMIT;
2663+START TRANSACTION;
2664+DROP TABLE IF EXISTS `test`.`t2`;
2665+COMMIT;
2666+START TRANSACTION;
2667+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2668 COMMIT;
2669 START TRANSACTION;
2670 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2671@@ -27,12 +27,16 @@
2672 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
2673 COMMIT;
2674 START TRANSACTION;
2675-CREATE TABLE t2 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL ) SELECT * FROM t1;
2676-COMMIT;
2677-START TRANSACTION;
2678-DROP TABLE `t1`;
2679-COMMIT;
2680-START TRANSACTION;
2681-DROP TABLE `t2`;
2682+CREATE TABLE `t2` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2683+COMMIT;
2684+START TRANSACTION;
2685+INSERT INTO `test`.`t2` (`id`,`padding`) VALUES (1,'I love testing.');
2686+INSERT INTO `test`.`t2` (`id`,`padding`) VALUES (2,'I hate testing.');
2687+COMMIT;
2688+START TRANSACTION;
2689+DROP TABLE `test`.`t1`;
2690+COMMIT;
2691+START TRANSACTION;
2692+DROP TABLE `test`.`t2`;
2693 COMMIT;
2694 SET GLOBAL transaction_log_truncate_debug= true;
2695
2696=== added file 'plugin/transaction_log/tests/r/create_table.result'
2697--- plugin/transaction_log/tests/r/create_table.result 1970-01-01 00:00:00 +0000
2698+++ plugin/transaction_log/tests/r/create_table.result 2010-03-02 21:04:16 +0000
2699@@ -0,0 +1,54 @@
2700+DROP TABLE IF EXISTS t1;
2701+CREATE TABLE t1 (
2702+autoinc_int_field INT NOT NULL AUTO_INCREMENT
2703+, null_int_field INT NULL
2704+, not_null_bigint_field BIGINT NOT NULL
2705+, null_bigint_field BIGINT NULL
2706+, not_null_int_field INT NOT NULL
2707+, null_varchar_field VARCHAR(100) NULL
2708+, not_null_varchar_field VARCHAR(100) NOT NULL
2709+, null_enum_field ENUM ('val1', 'val2') NULL
2710+, not_null_enum_field ENUM ('val1', 'val2') NOT NULL
2711+, null_date_field DATE NULL
2712+, not_null_date_field DATE NOT NULL
2713+, null_datetime_field DATETIME NULL
2714+, not_null_datetime_field DATETIME NOT NULL
2715+, null_blob_field BLOB NULL
2716+, not_null_blob_field BLOB NOT NULL
2717+, null_text_field TEXT NULL
2718+, not_null_text_field TEXT NOT NULL
2719+, null_timestamp_field TIMESTAMP NULL
2720+, not_null_timestamp_field TIMESTAMP NOT NULL
2721+, null_double_field DOUBLE NULL
2722+, not_null_double_field DOUBLE NOT NULL
2723+, null_decimal_field DECIMAL(10,2) NULL
2724+, not_null_decimal_field DECIMAL(10,2) NOT NULL
2725+, PRIMARY KEY (autoinc_int_field)
2726+);
2727+DROP TABLE t1;
2728+CREATE TABLE t1 (
2729+id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
2730+, key1 VARCHAR(10) NOT NULL
2731+, key2 DOUBLE NOT NULL
2732+, key3 BLOB NOT NULL
2733+, UNIQUE KEY (key1)
2734+, KEY named_key (key2)
2735+, KEY partial_key (key3(30))
2736+);
2737+DROP TABLE t1;
2738+START TRANSACTION;
2739+DROP TABLE IF EXISTS `test`.`t1`;
2740+COMMIT;
2741+START TRANSACTION;
2742+CREATE TABLE `t1` ( `autoinc_int_field` INT NOT NULL AUTO_INCREMENT, `null_int_field` INT NULL, `not_null_bigint_field` BIGINT NOT NULL, `null_bigint_field` BIGINT NULL, `not_null_int_field` INT NOT NULL, `null_varchar_field` VARCHAR(100) NULL COLLATE utf8_general_ci, `not_null_varchar_field` VARCHAR(100) NOT NULL COLLATE utf8_general_ci, `null_enum_field` ENUM('val1','val2') NULL, `not_null_enum_field` ENUM('val1','val2') NOT NULL, `null_date_field` DATE NULL, `not_null_date_field` DATE NOT NULL, `null_datetime_field` DATETIME NULL, `not_null_datetime_field` DATETIME NOT NULL, `null_blob_field` BLOB NULL COLLATE binary, `not_null_blob_field` BLOB NOT NULL COLLATE binary, `null_text_field` BLOB NULL COLLATE utf8_general_ci, `not_null_text_field` BLOB NOT NULL COLLATE utf8_general_ci, `null_timestamp_field` TIMESTAMP NULL, `not_null_timestamp_field` TIMESTAMP NOT NULL, `null_double_field` DOUBLE NULL, `not_null_double_field` DOUBLE NOT NULL, `null_decimal_field` DECIMAL(10,2) NULL, `not_null_decimal_field` DECIMAL(10,2) NOT NULL, PRIMARY KEY `PRIMARY` (`autoinc_int_field`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2743+COMMIT;
2744+START TRANSACTION;
2745+DROP TABLE `test`.`t1`;
2746+COMMIT;
2747+START TRANSACTION;
2748+CREATE TABLE `t1` ( `id` INT NOT NULL AUTO_INCREMENT, `key1` VARCHAR(10) NOT NULL COLLATE utf8_general_ci, `key2` DOUBLE NOT NULL, `key3` BLOB NOT NULL COLLATE binary, PRIMARY KEY `PRIMARY` (`id`), UNIQUE KEY `key1` (`key1`), KEY `named_key` (`key2`), KEY `partial_key` (`key3`(30)) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2749+COMMIT;
2750+START TRANSACTION;
2751+DROP TABLE `test`.`t1`;
2752+COMMIT;
2753+SET GLOBAL transaction_log_truncate_debug= true;
2754
2755=== modified file 'plugin/transaction_log/tests/r/database.result'
2756--- plugin/transaction_log/tests/r/database.result 2009-12-23 14:24:22 +0000
2757+++ plugin/transaction_log/tests/r/database.result 2010-03-02 21:04:16 +0000
2758@@ -1,7 +1,7 @@
2759 CREATE DATABASE test1;
2760 DROP DATABASE test1;
2761 START TRANSACTION;
2762-CREATE DATABASE test1;
2763+CREATE SCHEMA `test1` COLLATE utf8_general_ci;
2764 COMMIT;
2765 START TRANSACTION;
2766 DROP DATABASE test1;
2767
2768=== modified file 'plugin/transaction_log/tests/r/delete.result'
2769--- plugin/transaction_log/tests/r/delete.result 2009-12-23 14:24:22 +0000
2770+++ plugin/transaction_log/tests/r/delete.result 2010-03-02 21:04:16 +0000
2771@@ -37,10 +37,10 @@
2772 DROP TABLE t1;
2773 End Test of LP Bug #496101
2774 START TRANSACTION;
2775-DROP TABLE IF EXISTS `t1`;
2776+DROP TABLE IF EXISTS `test`.`t1`;
2777 COMMIT;
2778 START TRANSACTION;
2779-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
2780+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2781 COMMIT;
2782 START TRANSACTION;
2783 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2784@@ -52,10 +52,10 @@
2785 DELETE FROM `test`.`t1` WHERE `id`=1;
2786 COMMIT;
2787 START TRANSACTION;
2788-DROP TABLE `t1`;
2789+DROP TABLE `test`.`t1`;
2790 COMMIT;
2791 START TRANSACTION;
2792-CREATE TABLE t1 ( id INT NOT NULL , other INT NOT NULL , PRIMARY KEY (id) );
2793+CREATE TABLE `t1` ( `id` INT NOT NULL, `other` INT NOT NULL, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2794 COMMIT;
2795 START TRANSACTION;
2796 INSERT INTO `test`.`t1` (`id`,`other`) VALUES (1,1);
2797@@ -92,10 +92,10 @@
2798 DELETE FROM `test`.`t1` WHERE `id`=8;
2799 COMMIT;
2800 START TRANSACTION;
2801-DROP TABLE `t1`;
2802+DROP TABLE `test`.`t1`;
2803 COMMIT;
2804 START TRANSACTION;
2805-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
2806+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2807 COMMIT;
2808 START TRANSACTION;
2809 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2810@@ -103,6 +103,6 @@
2811 DELETE FROM `test`.`t1` WHERE `id`=1;
2812 COMMIT;
2813 START TRANSACTION;
2814-DROP TABLE `t1`;
2815+DROP TABLE `test`.`t1`;
2816 COMMIT;
2817 SET GLOBAL transaction_log_truncate_debug= true;
2818
2819=== modified file 'plugin/transaction_log/tests/r/filtered_replicator.result'
2820--- plugin/transaction_log/tests/r/filtered_replicator.result 2009-12-23 14:24:22 +0000
2821+++ plugin/transaction_log/tests/r/filtered_replicator.result 2010-03-02 21:04:16 +0000
2822@@ -36,8 +36,9 @@
2823 ALTER TABLE t1 ADD dummy INT;
2824 ALTER TABLE t1 ADD INDEX ix_padding (padding(20));
2825 DROP TABLE t1;
2826-CREATE DATABASE test1;
2827-DROP DATABASE test1;
2828+DROP SCHEMA IF EXISTS my_new_schema;
2829+CREATE SCHEMA my_new_warnings;
2830+DROP SCHEMA my_new_warnings;
2831 DROP TABLE IF EXISTS t1, t2;
2832 CREATE TABLE t1 (
2833 id INT NOT NULL
2834@@ -121,47 +122,44 @@
2835 UPDATE t1 SET id = 4 WHERE id = 2;
2836 DROP TABLE t1;
2837 START TRANSACTION;
2838-DROP TABLE IF EXISTS `t1`;
2839-COMMIT;
2840-START TRANSACTION;
2841-CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );
2842-COMMIT;
2843-START TRANSACTION;
2844-INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2845-COMMIT;
2846-START TRANSACTION;
2847-INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
2848-COMMIT;
2849-START TRANSACTION;
2850-DROP TABLE IF EXISTS `t1`;
2851-COMMIT;
2852-START TRANSACTION;
2853-CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );
2854-COMMIT;
2855-START TRANSACTION;
2856-INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2857-INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
2858-COMMIT;
2859-START TRANSACTION;
2860-DROP TABLE IF EXISTS `t1`;
2861-COMMIT;
2862-START TRANSACTION;
2863-DROP TABLE IF EXISTS `t2`;
2864-COMMIT;
2865-START TRANSACTION;
2866-CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );
2867-COMMIT;
2868-START TRANSACTION;
2869-INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2870-COMMIT;
2871-START TRANSACTION;
2872-INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
2873-COMMIT;
2874-START TRANSACTION;
2875-DROP TABLE IF EXISTS `t1`;
2876-COMMIT;
2877-START TRANSACTION;
2878-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
2879+DROP TABLE IF EXISTS `test`.`t1`;
2880+COMMIT;
2881+START TRANSACTION;
2882+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2883+COMMIT;
2884+START TRANSACTION;
2885+INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2886+COMMIT;
2887+START TRANSACTION;
2888+INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
2889+COMMIT;
2890+START TRANSACTION;
2891+DROP TABLE IF EXISTS `test`.`t1`;
2892+COMMIT;
2893+START TRANSACTION;
2894+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2895+COMMIT;
2896+START TRANSACTION;
2897+INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2898+INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
2899+COMMIT;
2900+START TRANSACTION;
2901+DROP TABLE IF EXISTS `test`.`t1`;
2902+COMMIT;
2903+START TRANSACTION;
2904+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2905+COMMIT;
2906+START TRANSACTION;
2907+INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2908+COMMIT;
2909+START TRANSACTION;
2910+INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
2911+COMMIT;
2912+START TRANSACTION;
2913+DROP TABLE IF EXISTS `test`.`t1`;
2914+COMMIT;
2915+START TRANSACTION;
2916+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2917 COMMIT;
2918 START TRANSACTION;
2919 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2920@@ -176,31 +174,31 @@
2921 ALTER TABLE t1 ADD INDEX ix_padding (padding(20));
2922 COMMIT;
2923 START TRANSACTION;
2924-DROP TABLE `t1`;
2925-COMMIT;
2926-START TRANSACTION;
2927-CREATE DATABASE test1;
2928-COMMIT;
2929-START TRANSACTION;
2930-DROP DATABASE test1;
2931-COMMIT;
2932-START TRANSACTION;
2933-DROP TABLE IF EXISTS `t1`;
2934-COMMIT;
2935-START TRANSACTION;
2936-DROP TABLE IF EXISTS `t2`;
2937-COMMIT;
2938-START TRANSACTION;
2939-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
2940+DROP TABLE `test`.`t1`;
2941+COMMIT;
2942+START TRANSACTION;
2943+DROP SCHEMA `my_new_schema`;
2944+COMMIT;
2945+START TRANSACTION;
2946+CREATE SCHEMA `my_new_warnings` COLLATE utf8_general_ci;
2947+COMMIT;
2948+START TRANSACTION;
2949+DROP SCHEMA `my_new_warnings`;
2950+COMMIT;
2951+START TRANSACTION;
2952+DROP TABLE IF EXISTS `test`.`t1`;
2953+COMMIT;
2954+START TRANSACTION;
2955+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2956 COMMIT;
2957 START TRANSACTION;
2958 RENAME TABLE t1 TO t2;
2959 COMMIT;
2960 START TRANSACTION;
2961-DROP TABLE IF EXISTS `t1`;
2962+DROP TABLE IF EXISTS `test`.`t1`;
2963 COMMIT;
2964 START TRANSACTION;
2965-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
2966+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2967 COMMIT;
2968 START TRANSACTION;
2969 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2970@@ -212,10 +210,10 @@
2971 DELETE FROM `test`.`t1` WHERE `id`=1;
2972 COMMIT;
2973 START TRANSACTION;
2974-DROP TABLE `t1`;
2975+DROP TABLE `test`.`t1`;
2976 COMMIT;
2977 START TRANSACTION;
2978-CREATE TABLE t1 ( id INT NOT NULL , other INT NOT NULL , PRIMARY KEY (id) );
2979+CREATE TABLE `t1` ( `id` INT NOT NULL, `other` INT NOT NULL, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2980 COMMIT;
2981 START TRANSACTION;
2982 INSERT INTO `test`.`t1` (`id`,`other`) VALUES (1,1);
2983@@ -252,10 +250,10 @@
2984 DELETE FROM `test`.`t1` WHERE `id`=8;
2985 COMMIT;
2986 START TRANSACTION;
2987-DROP TABLE `t1`;
2988+DROP TABLE `test`.`t1`;
2989 COMMIT;
2990 START TRANSACTION;
2991-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
2992+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
2993 COMMIT;
2994 START TRANSACTION;
2995 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2996@@ -263,13 +261,13 @@
2997 DELETE FROM `test`.`t1` WHERE `id`=1;
2998 COMMIT;
2999 START TRANSACTION;
3000-DROP TABLE `t1`;
3001-COMMIT;
3002-START TRANSACTION;
3003-DROP TABLE IF EXISTS `t1`;
3004-COMMIT;
3005-START TRANSACTION;
3006-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
3007+DROP TABLE `test`.`t1`;
3008+COMMIT;
3009+START TRANSACTION;
3010+DROP TABLE IF EXISTS `test`.`t1`;
3011+COMMIT;
3012+START TRANSACTION;
3013+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3014 COMMIT;
3015 START TRANSACTION;
3016 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
3017@@ -285,10 +283,10 @@
3018 UPDATE `test`.`t1` SET `padding`='AAA' WHERE `id`=2;
3019 COMMIT;
3020 START TRANSACTION;
3021-DROP TABLE `t1`;
3022+DROP TABLE `test`.`t1`;
3023 COMMIT;
3024 START TRANSACTION;
3025-CREATE TABLE t1 ( id int AUTO_INCREMENT NOT NULL PRIMARY KEY , name varchar(1024) , alias varchar(1024) );
3026+CREATE TABLE `t1` ( `id` INT NOT NULL AUTO_INCREMENT, `name` VARCHAR(1024) NOT NULL COLLATE utf8_general_ci, `alias` VARCHAR(1024) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3027 COMMIT;
3028 START TRANSACTION;
3029 INSERT INTO `test`.`t1` (`id`,`name`,`alias`) VALUES (1,'jeff lebowski','dude');
3030@@ -297,10 +295,10 @@
3031 UPDATE `test`.`t1` SET `alias`='the dude' WHERE `id`=1;
3032 COMMIT;
3033 START TRANSACTION;
3034-DROP TABLE `t1`;
3035+DROP TABLE `test`.`t1`;
3036 COMMIT;
3037 START TRANSACTION;
3038-CREATE TABLE t1 ( id INT NOT NULL , counter INT NOT NULL , PRIMARY KEY (id) );
3039+CREATE TABLE `t1` ( `id` INT NOT NULL, `counter` INT NOT NULL, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3040 COMMIT;
3041 START TRANSACTION;
3042 INSERT INTO `test`.`t1` (`id`,`counter`) VALUES (1,1);
3043@@ -315,10 +313,10 @@
3044 UPDATE `test`.`t1` SET `counter`=4 WHERE `id`=3;
3045 COMMIT;
3046 START TRANSACTION;
3047-DROP TABLE `t1`;
3048+DROP TABLE `test`.`t1`;
3049 COMMIT;
3050 START TRANSACTION;
3051-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
3052+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3053 COMMIT;
3054 START TRANSACTION;
3055 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
3056@@ -330,6 +328,6 @@
3057 UPDATE `test`.`t1` SET `id`=4 WHERE `id`=2;
3058 COMMIT;
3059 START TRANSACTION;
3060-DROP TABLE `t1`;
3061+DROP TABLE `test`.`t1`;
3062 COMMIT;
3063 SET GLOBAL transaction_log_truncate_debug= true;
3064
3065=== modified file 'plugin/transaction_log/tests/r/insert.result'
3066--- plugin/transaction_log/tests/r/insert.result 2009-12-23 14:24:22 +0000
3067+++ plugin/transaction_log/tests/r/insert.result 2010-03-02 21:04:16 +0000
3068@@ -6,10 +6,10 @@
3069 INSERT INTO t1 VALUES (1, "I love testing.");
3070 INSERT INTO t1 VALUES (2, "I hate testing.");
3071 START TRANSACTION;
3072-DROP TABLE IF EXISTS `t1`;
3073+DROP TABLE IF EXISTS `test`.`t1`;
3074 COMMIT;
3075 START TRANSACTION;
3076-CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );
3077+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3078 COMMIT;
3079 START TRANSACTION;
3080 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
3081
3082=== modified file 'plugin/transaction_log/tests/r/insert_multi.result'
3083--- plugin/transaction_log/tests/r/insert_multi.result 2009-12-23 14:24:22 +0000
3084+++ plugin/transaction_log/tests/r/insert_multi.result 2010-03-02 21:04:16 +0000
3085@@ -5,10 +5,10 @@
3086 );
3087 INSERT INTO t1 VALUES (1, "I love testing."), (2, "I hate testing.");
3088 START TRANSACTION;
3089-DROP TABLE IF EXISTS `t1`;
3090+DROP TABLE IF EXISTS `test`.`t1`;
3091 COMMIT;
3092 START TRANSACTION;
3093-CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );
3094+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3095 COMMIT;
3096 START TRANSACTION;
3097 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
3098
3099=== modified file 'plugin/transaction_log/tests/r/insert_on_duplicate_update.result'
3100--- plugin/transaction_log/tests/r/insert_on_duplicate_update.result 2009-12-23 14:24:22 +0000
3101+++ plugin/transaction_log/tests/r/insert_on_duplicate_update.result 2010-03-02 21:04:16 +0000
3102@@ -9,10 +9,10 @@
3103 ON DUPLICATE KEY UPDATE padding="I love testing";
3104 DROP TABLE t1;
3105 START TRANSACTION;
3106-DROP TABLE IF EXISTS `t1`;
3107+DROP TABLE IF EXISTS `test`.`t1`;
3108 COMMIT;
3109 START TRANSACTION;
3110-CREATE TABLE t1 ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , padding VARCHAR(200) NOT NULL );
3111+CREATE TABLE `t1` ( `id` INT NOT NULL AUTO_INCREMENT, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3112 COMMIT;
3113 START TRANSACTION;
3114 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
3115@@ -24,6 +24,6 @@
3116 UPDATE `test`.`t1` SET `padding`='I love testing' WHERE `id`=2;
3117 COMMIT;
3118 START TRANSACTION;
3119-DROP TABLE `t1`;
3120+DROP TABLE `test`.`t1`;
3121 COMMIT;
3122 SET GLOBAL transaction_log_truncate_debug= true;
3123
3124=== modified file 'plugin/transaction_log/tests/r/insert_select.result'
3125--- plugin/transaction_log/tests/r/insert_select.result 2009-12-23 14:24:22 +0000
3126+++ plugin/transaction_log/tests/r/insert_select.result 2010-03-02 21:04:16 +0000
3127@@ -12,13 +12,13 @@
3128 );
3129 INSERT INTO t2 SELECT * FROM t1;
3130 START TRANSACTION;
3131-DROP TABLE IF EXISTS `t1`;
3132-COMMIT;
3133-START TRANSACTION;
3134-DROP TABLE IF EXISTS `t2`;
3135-COMMIT;
3136-START TRANSACTION;
3137-CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );
3138+DROP TABLE IF EXISTS `test`.`t1`;
3139+COMMIT;
3140+START TRANSACTION;
3141+DROP TABLE IF EXISTS `test`.`t2`;
3142+COMMIT;
3143+START TRANSACTION;
3144+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3145 COMMIT;
3146 START TRANSACTION;
3147 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
3148@@ -27,7 +27,7 @@
3149 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
3150 COMMIT;
3151 START TRANSACTION;
3152-CREATE TABLE t2 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );
3153+CREATE TABLE `t2` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3154 COMMIT;
3155 START TRANSACTION;
3156 INSERT INTO `test`.`t2` (`id`,`padding`) VALUES (1,'I love testing.');
3157
3158=== added file 'plugin/transaction_log/tests/r/multi_column_primary_key.result'
3159--- plugin/transaction_log/tests/r/multi_column_primary_key.result 1970-01-01 00:00:00 +0000
3160+++ plugin/transaction_log/tests/r/multi_column_primary_key.result 2010-03-02 21:04:16 +0000
3161@@ -0,0 +1,55 @@
3162+DROP TABLE IF EXISTS t1;
3163+CREATE TABLE t1 (
3164+k1 INT NOT NULL
3165+, k2 INT NOT NULL
3166+, padding VARCHAR(200) NOT NULL
3167+, PRIMARY KEY (k1, k2)
3168+);
3169+INSERT INTO t1 VALUES (1, 1, "I love testing.");
3170+INSERT INTO t1 VALUES (2, 2, "I hate testing.");
3171+INSERT INTO t1 VALUES (2, 3, "I hate and love testing.");
3172+INSERT INTO t1 VALUES (3, 3, "I adore testing.");
3173+UPDATE t1 SET padding= "XXX" WHERE k1= 1 AND k2= 1;
3174+UPDATE t1 SET padding= "YYY" WHERE k1= 2;
3175+UPDATE t1 SET padding= "ZZZ" WHERE k2= 3;
3176+UPDATE t1 SET padding= "AAA";
3177+DROP TABLE t1;
3178+START TRANSACTION;
3179+DROP TABLE IF EXISTS `test`.`t1`;
3180+COMMIT;
3181+START TRANSACTION;
3182+CREATE TABLE `t1` ( `k1` INT NOT NULL, `k2` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`k1`,`k2`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3183+COMMIT;
3184+START TRANSACTION;
3185+INSERT INTO `test`.`t1` (`k1`,`k2`,`padding`) VALUES (1,1,'I love testing.');
3186+COMMIT;
3187+START TRANSACTION;
3188+INSERT INTO `test`.`t1` (`k1`,`k2`,`padding`) VALUES (2,2,'I hate testing.');
3189+COMMIT;
3190+START TRANSACTION;
3191+INSERT INTO `test`.`t1` (`k1`,`k2`,`padding`) VALUES (2,3,'I hate and love testing.');
3192+COMMIT;
3193+START TRANSACTION;
3194+INSERT INTO `test`.`t1` (`k1`,`k2`,`padding`) VALUES (3,3,'I adore testing.');
3195+COMMIT;
3196+START TRANSACTION;
3197+UPDATE `test`.`t1` SET `padding`='XXX' WHERE `k1`=1 AND `k2`=1;
3198+COMMIT;
3199+START TRANSACTION;
3200+UPDATE `test`.`t1` SET `padding`='YYY' WHERE `k1`=2 AND `k2`=2;
3201+UPDATE `test`.`t1` SET `padding`='YYY' WHERE `k1`=2 AND `k2`=3;
3202+COMMIT;
3203+START TRANSACTION;
3204+UPDATE `test`.`t1` SET `padding`='ZZZ' WHERE `k1`=2 AND `k2`=3;
3205+UPDATE `test`.`t1` SET `padding`='ZZZ' WHERE `k1`=3 AND `k2`=3;
3206+COMMIT;
3207+START TRANSACTION;
3208+UPDATE `test`.`t1` SET `padding`='AAA' WHERE `k1`=1 AND `k2`=1;
3209+UPDATE `test`.`t1` SET `padding`='AAA' WHERE `k1`=2 AND `k2`=2;
3210+UPDATE `test`.`t1` SET `padding`='AAA' WHERE `k1`=2 AND `k2`=3;
3211+UPDATE `test`.`t1` SET `padding`='AAA' WHERE `k1`=3 AND `k2`=3;
3212+COMMIT;
3213+START TRANSACTION;
3214+DROP TABLE `test`.`t1`;
3215+COMMIT;
3216+SET GLOBAL transaction_log_truncate_debug= true;
3217
3218=== modified file 'plugin/transaction_log/tests/r/no_modification.result'
3219--- plugin/transaction_log/tests/r/no_modification.result 2009-12-23 14:24:22 +0000
3220+++ plugin/transaction_log/tests/r/no_modification.result 2010-03-02 21:04:16 +0000
3221@@ -15,10 +15,10 @@
3222 2 I hate testing.
3223 COMMIT;
3224 START TRANSACTION;
3225-DROP TABLE IF EXISTS `t1`;
3226+DROP TABLE IF EXISTS `test`.`t1`;
3227 COMMIT;
3228 START TRANSACTION;
3229-CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );
3230+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3231 COMMIT;
3232 START TRANSACTION;
3233 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
3234
3235=== modified file 'plugin/transaction_log/tests/r/no_primary_key.result'
3236--- plugin/transaction_log/tests/r/no_primary_key.result 2009-12-23 14:24:22 +0000
3237+++ plugin/transaction_log/tests/r/no_primary_key.result 2010-03-02 21:04:16 +0000
3238@@ -7,12 +7,12 @@
3239 ERROR HY000: Tables which are replicated require a primary key.
3240 DROP TABLE t1;
3241 START TRANSACTION;
3242-DROP TABLE IF EXISTS `t1`;
3243-COMMIT;
3244-START TRANSACTION;
3245-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL );
3246-COMMIT;
3247-START TRANSACTION;
3248-DROP TABLE `t1`;
3249+DROP TABLE IF EXISTS `test`.`t1`;
3250+COMMIT;
3251+START TRANSACTION;
3252+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3253+COMMIT;
3254+START TRANSACTION;
3255+DROP TABLE `test`.`t1`;
3256 COMMIT;
3257 SET GLOBAL transaction_log_truncate_debug= true;
3258
3259=== modified file 'plugin/transaction_log/tests/r/rand.result'
3260--- plugin/transaction_log/tests/r/rand.result 2009-12-23 14:24:22 +0000
3261+++ plugin/transaction_log/tests/r/rand.result 2010-03-02 21:04:16 +0000
3262@@ -7,10 +7,10 @@
3263 INSERT INTO t1 SELECT RAND(100)*100 FROM t1;
3264 DROP TABLE t1;
3265 START TRANSACTION;
3266-DROP TABLE IF EXISTS `t1`;
3267+DROP TABLE IF EXISTS `test`.`t1`;
3268 COMMIT;
3269 START TRANSACTION;
3270-CREATE TABLE t1 ( id INT NOT NULL , PRIMARY KEY (id) );
3271+CREATE TABLE `t1` ( `id` INT NOT NULL, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3272 COMMIT;
3273 START TRANSACTION;
3274 INSERT INTO `test`.`t1` (`id`) VALUES (1);
3275@@ -19,6 +19,6 @@
3276 INSERT INTO `test`.`t1` (`id`) VALUES (17);
3277 COMMIT;
3278 START TRANSACTION;
3279-DROP TABLE `t1`;
3280+DROP TABLE `test`.`t1`;
3281 COMMIT;
3282 SET GLOBAL transaction_log_truncate_debug= true;
3283
3284=== modified file 'plugin/transaction_log/tests/r/rename.result'
3285--- plugin/transaction_log/tests/r/rename.result 2009-12-23 14:24:22 +0000
3286+++ plugin/transaction_log/tests/r/rename.result 2010-03-02 21:04:16 +0000
3287@@ -6,13 +6,13 @@
3288 );
3289 RENAME TABLE t1 TO t2;
3290 START TRANSACTION;
3291-DROP TABLE IF EXISTS `t1`;
3292-COMMIT;
3293-START TRANSACTION;
3294-DROP TABLE IF EXISTS `t2`;
3295-COMMIT;
3296-START TRANSACTION;
3297-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
3298+DROP TABLE IF EXISTS `test`.`t1`;
3299+COMMIT;
3300+START TRANSACTION;
3301+DROP TABLE IF EXISTS `test`.`t2`;
3302+COMMIT;
3303+START TRANSACTION;
3304+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3305 COMMIT;
3306 START TRANSACTION;
3307 RENAME TABLE t1 TO t2;
3308
3309=== modified file 'plugin/transaction_log/tests/r/replace.result'
3310--- plugin/transaction_log/tests/r/replace.result 2009-12-23 14:24:22 +0000
3311+++ plugin/transaction_log/tests/r/replace.result 2010-03-02 21:04:16 +0000
3312@@ -21,13 +21,13 @@
3313 REPLACE INTO t1 VALUE (2, "I love testing.");
3314 DROP TABLE t2, t1;
3315 START TRANSACTION;
3316-DROP TABLE IF EXISTS `t1`;
3317-COMMIT;
3318-START TRANSACTION;
3319-DROP TABLE IF EXISTS `t2`;
3320-COMMIT;
3321-START TRANSACTION;
3322-CREATE TABLE t1 ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , padding VARCHAR(200) NOT NULL ) ENGINE=InnoDB;
3323+DROP TABLE IF EXISTS `test`.`t1`;
3324+COMMIT;
3325+START TRANSACTION;
3326+DROP TABLE IF EXISTS `test`.`t2`;
3327+COMMIT;
3328+START TRANSACTION;
3329+CREATE TABLE `t1` ( `id` INT NOT NULL AUTO_INCREMENT, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3330 COMMIT;
3331 START TRANSACTION;
3332 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
3333@@ -39,13 +39,13 @@
3334 UPDATE `test`.`t1` SET `padding`='I love testing.' WHERE `id`=2;
3335 COMMIT;
3336 START TRANSACTION;
3337-DROP TABLE `t1`;
3338-COMMIT;
3339-START TRANSACTION;
3340-CREATE TABLE t1 ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , padding VARCHAR(200) NOT NULL ) ENGINE=InnoDB;
3341-COMMIT;
3342-START TRANSACTION;
3343-CREATE TABLE t2 ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , fk_id INT NOT NULL , CONSTRAINT fk_t1 FOREIGN KEY (fk_id) REFERENCES t1 (id) ON DELETE CASCADE ) ENGINE=InnoDB;
3344+DROP TABLE `test`.`t1`;
3345+COMMIT;
3346+START TRANSACTION;
3347+CREATE TABLE `t1` ( `id` INT NOT NULL AUTO_INCREMENT, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3348+COMMIT;
3349+START TRANSACTION;
3350+CREATE TABLE `t2` ( `id` INT NOT NULL AUTO_INCREMENT, `fk_id` INT NOT NULL, PRIMARY KEY `PRIMARY` (`id`), KEY `fk_t1` (`fk_id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3351 COMMIT;
3352 START TRANSACTION;
3353 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
3354@@ -58,9 +58,9 @@
3355 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I love testing.');
3356 COMMIT;
3357 START TRANSACTION;
3358-DROP TABLE `t2`;
3359+DROP TABLE `test`.`t2`;
3360 COMMIT;
3361 START TRANSACTION;
3362-DROP TABLE `t1`;
3363+DROP TABLE `test`.`t1`;
3364 COMMIT;
3365 SET GLOBAL transaction_log_truncate_debug= true;
3366
3367=== modified file 'plugin/transaction_log/tests/r/rollback.result'
3368--- plugin/transaction_log/tests/r/rollback.result 2009-12-23 14:24:22 +0000
3369+++ plugin/transaction_log/tests/r/rollback.result 2010-03-02 21:04:16 +0000
3370@@ -13,12 +13,12 @@
3371 ROLLBACK;
3372 DROP TABLE t1;
3373 START TRANSACTION;
3374-DROP TABLE IF EXISTS `t1`;
3375-COMMIT;
3376-START TRANSACTION;
3377-CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );
3378-COMMIT;
3379-START TRANSACTION;
3380-DROP TABLE `t1`;
3381+DROP TABLE IF EXISTS `test`.`t1`;
3382+COMMIT;
3383+START TRANSACTION;
3384+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3385+COMMIT;
3386+START TRANSACTION;
3387+DROP TABLE `test`.`t1`;
3388 COMMIT;
3389 SET GLOBAL transaction_log_truncate_debug= true;
3390
3391=== added file 'plugin/transaction_log/tests/r/schema.result'
3392--- plugin/transaction_log/tests/r/schema.result 1970-01-01 00:00:00 +0000
3393+++ plugin/transaction_log/tests/r/schema.result 2010-03-02 21:04:16 +0000
3394@@ -0,0 +1,13 @@
3395+DROP SCHEMA IF EXISTS my_new_schema;
3396+CREATE SCHEMA my_new_warnings;
3397+DROP SCHEMA my_new_warnings;
3398+START TRANSACTION;
3399+DROP SCHEMA `my_new_schema`;
3400+COMMIT;
3401+START TRANSACTION;
3402+CREATE SCHEMA `my_new_warnings` COLLATE utf8_general_ci;
3403+COMMIT;
3404+START TRANSACTION;
3405+DROP SCHEMA `my_new_warnings`;
3406+COMMIT;
3407+SET GLOBAL transaction_log_truncate_debug= true;
3408
3409=== modified file 'plugin/transaction_log/tests/r/select_for_update.result'
3410--- plugin/transaction_log/tests/r/select_for_update.result 2009-12-23 14:24:22 +0000
3411+++ plugin/transaction_log/tests/r/select_for_update.result 2010-03-02 21:04:16 +0000
3412@@ -19,10 +19,10 @@
3413 COMMIT;
3414 DROP TABLE t1;
3415 START TRANSACTION;
3416-DROP TABLE IF EXISTS `t1`;
3417+DROP TABLE IF EXISTS `test`.`t1`;
3418 COMMIT;
3419 START TRANSACTION;
3420-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
3421+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3422 COMMIT;
3423 START TRANSACTION;
3424 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
3425@@ -39,6 +39,6 @@
3426 UPDATE `test`.`t1` SET `id`=6 WHERE `id`=5;
3427 COMMIT;
3428 START TRANSACTION;
3429-DROP TABLE `t1`;
3430+DROP TABLE `test`.`t1`;
3431 COMMIT;
3432 SET GLOBAL transaction_log_truncate_debug= true;
3433
3434=== modified file 'plugin/transaction_log/tests/r/temp_tables.result'
3435--- plugin/transaction_log/tests/r/temp_tables.result 2009-12-23 14:24:22 +0000
3436+++ plugin/transaction_log/tests/r/temp_tables.result 2010-03-02 21:04:16 +0000
3437@@ -10,10 +10,10 @@
3438 DROP TABLE t1;
3439 DROP TABLE t2;
3440 START TRANSACTION;
3441-DROP TABLE IF EXISTS `t1`;
3442+DROP TABLE IF EXISTS `test`.`t1`;
3443 COMMIT;
3444 START TRANSACTION;
3445-DROP TABLE IF EXISTS `t2`;
3446+DROP TABLE IF EXISTS `test`.`t2`;
3447 COMMIT;
3448 START TRANSACTION;
3449 CREATE TABLE `t2` ( `id` int NOT NULL, `padding` varchar(200) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB;
3450@@ -23,6 +23,6 @@
3451 INSERT INTO `test`.`t2` (`id`,`padding`) VALUES (2,'I hate testing.');
3452 COMMIT;
3453 START TRANSACTION;
3454-DROP TABLE `t2`;
3455+DROP TABLE `test`.`t2`;
3456 COMMIT;
3457 SET GLOBAL transaction_log_truncate_debug= true;
3458
3459=== modified file 'plugin/transaction_log/tests/r/truncate.result'
3460--- plugin/transaction_log/tests/r/truncate.result 2009-12-23 14:24:22 +0000
3461+++ plugin/transaction_log/tests/r/truncate.result 2010-03-02 21:04:16 +0000
3462@@ -7,10 +7,10 @@
3463 INSERT INTO t1 VALUES (2, "I hate testing.");
3464 TRUNCATE TABLE t1;
3465 START TRANSACTION;
3466-DROP TABLE IF EXISTS `t1`;
3467+DROP TABLE IF EXISTS `test`.`t1`;
3468 COMMIT;
3469 START TRANSACTION;
3470-CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );
3471+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3472 COMMIT;
3473 START TRANSACTION;
3474 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
3475
3476=== modified file 'plugin/transaction_log/tests/r/truncate_log.result'
3477--- plugin/transaction_log/tests/r/truncate_log.result 2009-12-11 19:08:29 +0000
3478+++ plugin/transaction_log/tests/r/truncate_log.result 2010-03-02 21:04:16 +0000
3479@@ -5,6 +5,6 @@
3480 );
3481 INSERT INTO t1 VALUES (1, "I love testing.");
3482 INSERT INTO t1 VALUES (2, "I hate testing.");
3483-17var/master-data/transaction.log
3484+24var/master-data/transaction.log
3485 SET GLOBAL transaction_log_truncate_debug= true;
3486 0var/master-data/transaction.log
3487
3488=== modified file 'plugin/transaction_log/tests/r/update.result'
3489--- plugin/transaction_log/tests/r/update.result 2009-12-23 14:24:22 +0000
3490+++ plugin/transaction_log/tests/r/update.result 2010-03-02 21:04:16 +0000
3491@@ -36,10 +36,10 @@
3492 UPDATE t1 SET id = 4 WHERE id = 2;
3493 DROP TABLE t1;
3494 START TRANSACTION;
3495-DROP TABLE IF EXISTS `t1`;
3496+DROP TABLE IF EXISTS `test`.`t1`;
3497 COMMIT;
3498 START TRANSACTION;
3499-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
3500+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3501 COMMIT;
3502 START TRANSACTION;
3503 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
3504@@ -55,10 +55,10 @@
3505 UPDATE `test`.`t1` SET `padding`='AAA' WHERE `id`=2;
3506 COMMIT;
3507 START TRANSACTION;
3508-DROP TABLE `t1`;
3509+DROP TABLE `test`.`t1`;
3510 COMMIT;
3511 START TRANSACTION;
3512-CREATE TABLE t1 ( id int AUTO_INCREMENT NOT NULL PRIMARY KEY , name varchar(1024) , alias varchar(1024) );
3513+CREATE TABLE `t1` ( `id` INT NOT NULL AUTO_INCREMENT, `name` VARCHAR(1024) NOT NULL COLLATE utf8_general_ci, `alias` VARCHAR(1024) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3514 COMMIT;
3515 START TRANSACTION;
3516 INSERT INTO `test`.`t1` (`id`,`name`,`alias`) VALUES (1,'jeff lebowski','dude');
3517@@ -67,10 +67,10 @@
3518 UPDATE `test`.`t1` SET `alias`='the dude' WHERE `id`=1;
3519 COMMIT;
3520 START TRANSACTION;
3521-DROP TABLE `t1`;
3522+DROP TABLE `test`.`t1`;
3523 COMMIT;
3524 START TRANSACTION;
3525-CREATE TABLE t1 ( id INT NOT NULL , counter INT NOT NULL , PRIMARY KEY (id) );
3526+CREATE TABLE `t1` ( `id` INT NOT NULL, `counter` INT NOT NULL, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3527 COMMIT;
3528 START TRANSACTION;
3529 INSERT INTO `test`.`t1` (`id`,`counter`) VALUES (1,1);
3530@@ -85,10 +85,10 @@
3531 UPDATE `test`.`t1` SET `counter`=4 WHERE `id`=3;
3532 COMMIT;
3533 START TRANSACTION;
3534-DROP TABLE `t1`;
3535+DROP TABLE `test`.`t1`;
3536 COMMIT;
3537 START TRANSACTION;
3538-CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
3539+CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
3540 COMMIT;
3541 START TRANSACTION;
3542 INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
3543@@ -100,6 +100,6 @@
3544 UPDATE `test`.`t1` SET `id`=4 WHERE `id`=2;
3545 COMMIT;
3546 START TRANSACTION;
3547-DROP TABLE `t1`;
3548+DROP TABLE `test`.`t1`;
3549 COMMIT;
3550 SET GLOBAL transaction_log_truncate_debug= true;
3551
3552=== added file 'plugin/transaction_log/tests/t/create_table-master.opt'
3553--- plugin/transaction_log/tests/t/create_table-master.opt 1970-01-01 00:00:00 +0000
3554+++ plugin/transaction_log/tests/t/create_table-master.opt 2010-03-02 21:04:16 +0000
3555@@ -0,0 +1,1 @@
3556+--default-replicator-enable --transaction-log-enable --scheduler=multi_thread
3557
3558=== added file 'plugin/transaction_log/tests/t/create_table.inc'
3559--- plugin/transaction_log/tests/t/create_table.inc 1970-01-01 00:00:00 +0000
3560+++ plugin/transaction_log/tests/t/create_table.inc 2010-03-02 21:04:16 +0000
3561@@ -0,0 +1,53 @@
3562+#
3563+# Tests tons of different CREATE TABLE
3564+# variations and the replication stream
3565+#
3566+
3567+--disable_warnings
3568+DROP TABLE IF EXISTS t1;
3569+--enable_warnings
3570+
3571+# Test the field generation
3572+
3573+CREATE TABLE t1 (
3574+ autoinc_int_field INT NOT NULL AUTO_INCREMENT
3575+, null_int_field INT NULL
3576+, not_null_bigint_field BIGINT NOT NULL
3577+, null_bigint_field BIGINT NULL
3578+, not_null_int_field INT NOT NULL
3579+, null_varchar_field VARCHAR(100) NULL
3580+, not_null_varchar_field VARCHAR(100) NOT NULL
3581+, null_enum_field ENUM ('val1', 'val2') NULL
3582+, not_null_enum_field ENUM ('val1', 'val2') NOT NULL
3583+, null_date_field DATE NULL
3584+, not_null_date_field DATE NOT NULL
3585+, null_datetime_field DATETIME NULL
3586+, not_null_datetime_field DATETIME NOT NULL
3587+, null_blob_field BLOB NULL
3588+, not_null_blob_field BLOB NOT NULL
3589+, null_text_field TEXT NULL
3590+, not_null_text_field TEXT NOT NULL
3591+, null_timestamp_field TIMESTAMP NULL
3592+, not_null_timestamp_field TIMESTAMP NOT NULL
3593+, null_double_field DOUBLE NULL
3594+, not_null_double_field DOUBLE NOT NULL
3595+, null_decimal_field DECIMAL(10,2) NULL
3596+, not_null_decimal_field DECIMAL(10,2) NOT NULL
3597+, PRIMARY KEY (autoinc_int_field)
3598+);
3599+
3600+DROP TABLE t1;
3601+
3602+# Test the index generation
3603+
3604+CREATE TABLE t1 (
3605+ id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
3606+, key1 VARCHAR(10) NOT NULL
3607+, key2 DOUBLE NOT NULL
3608+, key3 BLOB NOT NULL
3609+, UNIQUE KEY (key1)
3610+, KEY named_key (key2)
3611+, KEY partial_key (key3(30))
3612+);
3613+
3614+DROP TABLE t1;
3615
3616=== added file 'plugin/transaction_log/tests/t/create_table.test'
3617--- plugin/transaction_log/tests/t/create_table.test 1970-01-01 00:00:00 +0000
3618+++ plugin/transaction_log/tests/t/create_table.test 2010-03-02 21:04:16 +0000
3619@@ -0,0 +1,9 @@
3620+# Populate log with some records...
3621+--source ../plugin/transaction_log/tests/t/create_table.inc
3622+
3623+# Read in the transaction.log.
3624+
3625+--exec ../drizzled/message/transaction_reader var/master-data/transaction.log
3626+
3627+# Truncate the log file to reset for the next test
3628+--source ../plugin/transaction_log/tests/t/truncate_log.inc
3629
3630=== removed file 'plugin/transaction_log/tests/t/database.inc'
3631--- plugin/transaction_log/tests/t/database.inc 2009-07-02 05:08:33 +0000
3632+++ plugin/transaction_log/tests/t/database.inc 1970-01-01 00:00:00 +0000
3633@@ -1,12 +0,0 @@
3634-#
3635-# Simple test of the serial event log for CREATE DATABASE and
3636-# DROP DATABASE
3637-#
3638-# Create a database then drop a database
3639-#
3640-# We then use the transaction_reader in drizzled/message/ to read the events.
3641-#
3642-
3643-# CREATE DATABASE
3644-CREATE DATABASE test1;
3645-DROP DATABASE test1;
3646
3647=== removed file 'plugin/transaction_log/tests/t/database.test'
3648--- plugin/transaction_log/tests/t/database.test 2009-12-04 18:50:04 +0000
3649+++ plugin/transaction_log/tests/t/database.test 1970-01-01 00:00:00 +0000
3650@@ -1,13 +0,0 @@
3651-#
3652-# Tests simple CREATE DATABASE and DROP DATABASE statements and the transaction log
3653-#
3654-
3655-# Populate log with some records...
3656---source ../plugin/transaction_log/tests/t/database.inc
3657-
3658-# Read in the transaction.log.
3659-
3660---exec ../drizzled/message/transaction_reader var/master-data/transaction.log
3661-
3662-# Truncate the log file to reset for the next test
3663---source ../plugin/transaction_log/tests/t/truncate_log.inc
3664
3665=== modified file 'plugin/transaction_log/tests/t/filtered_replicator.test'
3666--- plugin/transaction_log/tests/t/filtered_replicator.test 2009-12-04 18:50:04 +0000
3667+++ plugin/transaction_log/tests/t/filtered_replicator.test 2010-03-02 21:04:16 +0000
3668@@ -16,7 +16,7 @@
3669 --source ../plugin/transaction_log/tests/t/insert_multi.inc
3670 --source ../plugin/transaction_log/tests/t/insert_select.inc
3671 --source ../plugin/transaction_log/tests/t/alter.inc
3672---source ../plugin/transaction_log/tests/t/database.inc
3673+--source ../plugin/transaction_log/tests/t/schema.inc
3674 --source ../plugin/transaction_log/tests/t/rename.inc
3675 --source ../plugin/transaction_log/tests/t/delete.inc
3676 --source ../plugin/transaction_log/tests/t/update.inc
3677
3678=== added file 'plugin/transaction_log/tests/t/multi_column_primary_key-master.opt'
3679--- plugin/transaction_log/tests/t/multi_column_primary_key-master.opt 1970-01-01 00:00:00 +0000
3680+++ plugin/transaction_log/tests/t/multi_column_primary_key-master.opt 2010-03-02 21:04:16 +0000
3681@@ -0,0 +1,1 @@
3682+--default-replicator-enable --transaction-log-enable --scheduler=multi_thread
3683
3684=== added file 'plugin/transaction_log/tests/t/multi_column_primary_key.inc'
3685--- plugin/transaction_log/tests/t/multi_column_primary_key.inc 1970-01-01 00:00:00 +0000
3686+++ plugin/transaction_log/tests/t/multi_column_primary_key.inc 2010-03-02 21:04:16 +0000
3687@@ -0,0 +1,36 @@
3688+#
3689+# Test that tables with multi-column primary keys
3690+# are handled properly in replication
3691+#
3692+
3693+--disable_warnings
3694+DROP TABLE IF EXISTS t1;
3695+--enable_warnings
3696+
3697+CREATE TABLE t1 (
3698+ k1 INT NOT NULL
3699+, k2 INT NOT NULL
3700+, padding VARCHAR(200) NOT NULL
3701+, PRIMARY KEY (k1, k2)
3702+);
3703+
3704+INSERT INTO t1 VALUES (1, 1, "I love testing.");
3705+INSERT INTO t1 VALUES (2, 2, "I hate testing.");
3706+INSERT INTO t1 VALUES (2, 3, "I hate and love testing.");
3707+INSERT INTO t1 VALUES (3, 3, "I adore testing.");
3708+
3709+# Simple PK update on both columns
3710+UPDATE t1 SET padding= "XXX" WHERE k1= 1 AND k2= 1;
3711+
3712+# UPDATE all records in table matching first column
3713+# in primary key
3714+UPDATE t1 SET padding= "YYY" WHERE k1= 2;
3715+
3716+# UPDATE all records in table matching second column
3717+# in primary key
3718+UPDATE t1 SET padding= "ZZZ" WHERE k2= 3;
3719+
3720+# UPDATE all records in table
3721+UPDATE t1 SET padding= "AAA";
3722+
3723+DROP TABLE t1;
3724
3725=== added file 'plugin/transaction_log/tests/t/multi_column_primary_key.test'
3726--- plugin/transaction_log/tests/t/multi_column_primary_key.test 1970-01-01 00:00:00 +0000
3727+++ plugin/transaction_log/tests/t/multi_column_primary_key.test 2010-03-02 21:04:16 +0000
3728@@ -0,0 +1,9 @@
3729+# Populate log with some records...
3730+--source ../plugin/transaction_log/tests/t/multi_column_primary_key.inc
3731+
3732+# Read in the transaction.log.
3733+
3734+--exec ../drizzled/message/transaction_reader var/master-data/transaction.log
3735+
3736+# Truncate the log file to reset for the next test
3737+--source ../plugin/transaction_log/tests/t/truncate_log.inc
3738
3739=== added file 'plugin/transaction_log/tests/t/schema-master.opt'
3740--- plugin/transaction_log/tests/t/schema-master.opt 1970-01-01 00:00:00 +0000
3741+++ plugin/transaction_log/tests/t/schema-master.opt 2010-03-02 21:04:16 +0000
3742@@ -0,0 +1,1 @@
3743+--default-replicator-enable --transaction-log-enable --scheduler=multi_thread
3744
3745=== added file 'plugin/transaction_log/tests/t/schema.inc'
3746--- plugin/transaction_log/tests/t/schema.inc 1970-01-01 00:00:00 +0000
3747+++ plugin/transaction_log/tests/t/schema.inc 2010-03-02 21:04:16 +0000
3748@@ -0,0 +1,12 @@
3749+#
3750+# Test CREATE SCHEMA, DROP SCHEMA, ALTER SCHEMA
3751+# and the replication stream
3752+#
3753+
3754+--disable_warnings
3755+DROP SCHEMA IF EXISTS my_new_schema;
3756+--enable_warnings
3757+
3758+CREATE SCHEMA my_new_warnings;
3759+
3760+DROP SCHEMA my_new_warnings;
3761
3762=== added file 'plugin/transaction_log/tests/t/schema.test'
3763--- plugin/transaction_log/tests/t/schema.test 1970-01-01 00:00:00 +0000
3764+++ plugin/transaction_log/tests/t/schema.test 2010-03-02 21:04:16 +0000
3765@@ -0,0 +1,9 @@
3766+# Populate log with some records...
3767+--source ../plugin/transaction_log/tests/t/schema.inc
3768+
3769+# Read in the transaction.log.
3770+
3771+--exec ../drizzled/message/transaction_reader var/master-data/transaction.log
3772+
3773+# Truncate the log file to reset for the next test
3774+--source ../plugin/transaction_log/tests/t/truncate_log.inc
3775
3776=== modified file 'tests/r/innodb.result'
3777--- tests/r/innodb.result 2010-03-01 22:24:10 +0000
3778+++ tests/r/innodb.result 2010-03-02 21:04:16 +0000
3779@@ -1130,24 +1130,24 @@
3780 checksum table t1, t2, t3, t4;
3781 Table Checksum
3782 test.t1 2948697075
3783-test.t2 2948697075
3784-test.t3 2948697075
3785-test.t4 NULL
3786-Warnings:
3787-Error 1146 Table 'test.t4' doesn't exist
3788-checksum table t1, t2, t3, t4;
3789-Table Checksum
3790-test.t1 2948697075
3791-test.t2 2948697075
3792-test.t3 2948697075
3793-test.t4 NULL
3794-Warnings:
3795-Error 1146 Table 'test.t4' doesn't exist
3796-checksum table t1, t2, t3, t4;
3797-Table Checksum
3798-test.t1 2948697075
3799-test.t2 2948697075
3800-test.t3 2948697075
3801+test.t2 3505595080
3802+test.t3 3505595080
3803+test.t4 NULL
3804+Warnings:
3805+Error 1146 Table 'test.t4' doesn't exist
3806+checksum table t1, t2, t3, t4;
3807+Table Checksum
3808+test.t1 2948697075
3809+test.t2 3505595080
3810+test.t3 3505595080
3811+test.t4 NULL
3812+Warnings:
3813+Error 1146 Table 'test.t4' doesn't exist
3814+checksum table t1, t2, t3, t4;
3815+Table Checksum
3816+test.t1 2948697075
3817+test.t2 3505595080
3818+test.t3 3505595080
3819 test.t4 NULL
3820 Warnings:
3821 Error 1146 Table 'test.t4' doesn't exist
3822
3823=== modified file 'tests/r/mix2_myisam.result'
3824--- tests/r/mix2_myisam.result 2010-02-19 19:04:24 +0000
3825+++ tests/r/mix2_myisam.result 2010-03-02 21:04:16 +0000
3826@@ -898,30 +898,30 @@
3827 Table Checksum
3828 test.t1 2948697075
3829 test.t2 2948697075
3830-test.t3 2948697075
3831-test.t4 2948697075
3832-test.t5 2948697075
3833-test.t6 2948697075
3834-test.t7 NULL
3835-Warnings:
3836-Error 1146 Table 'test.t7' doesn't exist
3837-checksum table t1, t2, t3, t4, t5, t6, t7;
3838-Table Checksum
3839-test.t1 2948697075
3840-test.t2 2948697075
3841-test.t3 2948697075
3842-test.t4 2948697075
3843-test.t5 2948697075
3844-test.t6 2948697075
3845-test.t7 NULL
3846-Warnings:
3847-Error 1146 Table 'test.t7' doesn't exist
3848-checksum table t1, t2, t3, t4, t5, t6, t7;
3849-Table Checksum
3850-test.t1 2948697075
3851-test.t2 2948697075
3852-test.t3 2948697075
3853-test.t4 2948697075
3854+test.t3 3505595080
3855+test.t4 3505595080
3856+test.t5 2948697075
3857+test.t6 2948697075
3858+test.t7 NULL
3859+Warnings:
3860+Error 1146 Table 'test.t7' doesn't exist
3861+checksum table t1, t2, t3, t4, t5, t6, t7;
3862+Table Checksum
3863+test.t1 2948697075
3864+test.t2 2948697075
3865+test.t3 3505595080
3866+test.t4 3505595080
3867+test.t5 2948697075
3868+test.t6 2948697075
3869+test.t7 NULL
3870+Warnings:
3871+Error 1146 Table 'test.t7' doesn't exist
3872+checksum table t1, t2, t3, t4, t5, t6, t7;
3873+Table Checksum
3874+test.t1 2948697075
3875+test.t2 2948697075
3876+test.t3 3505595080
3877+test.t4 3505595080
3878 test.t5 2948697075
3879 test.t6 2948697075
3880 test.t7 NULL
3881
3882=== modified file 'tests/r/myisam.result'
3883--- tests/r/myisam.result 2010-03-01 22:24:10 +0000
3884+++ tests/r/myisam.result 2010-03-02 21:04:16 +0000
3885@@ -490,22 +490,22 @@
3886 insert t2 select * from t1;
3887 checksum table t1, t2, t3;
3888 Table Checksum
3889-test.t1 2948697075
3890-test.t2 2948697075
3891-test.t3 NULL
3892-Warnings:
3893-Error 1146 Table 'test.t3' doesn't exist
3894-checksum table t1, t2, t3;
3895-Table Checksum
3896-test.t1 2948697075
3897-test.t2 2948697075
3898-test.t3 NULL
3899-Warnings:
3900-Error 1146 Table 'test.t3' doesn't exist
3901-checksum table t1, t2, t3;
3902-Table Checksum
3903-test.t1 2948697075
3904-test.t2 2948697075
3905+test.t1 3505595080
3906+test.t2 3505595080
3907+test.t3 NULL
3908+Warnings:
3909+Error 1146 Table 'test.t3' doesn't exist
3910+checksum table t1, t2, t3;
3911+Table Checksum
3912+test.t1 3505595080
3913+test.t2 3505595080
3914+test.t3 NULL
3915+Warnings:
3916+Error 1146 Table 'test.t3' doesn't exist
3917+checksum table t1, t2, t3;
3918+Table Checksum
3919+test.t1 3505595080
3920+test.t2 3505595080
3921 test.t3 NULL
3922 Warnings:
3923 Error 1146 Table 'test.t3' doesn't exist