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
=== modified file 'drizzled/cursor.cc'
--- drizzled/cursor.cc 2010-02-23 18:09:22 +0000
+++ drizzled/cursor.cc 2010-03-02 21:04:16 +0000
@@ -1353,6 +1353,18 @@
13531353
1354 switch (session->lex->sql_command)1354 switch (session->lex->sql_command)
1355 {1355 {
1356 case SQLCOM_CREATE_TABLE:
1357 /*
1358 * We are in a CREATE TABLE ... SELECT statement
1359 * and the kernel has already created the table
1360 * and put a CreateTableStatement in the active
1361 * Transaction message. Here, we add a new InsertRecord
1362 * to a new Transaction message (because the above
1363 * CREATE TABLE will commit the transaction containing
1364 * it).
1365 */
1366 result= replication_services.insertRecord(session, table);
1367 break;
1356 case SQLCOM_REPLACE:1368 case SQLCOM_REPLACE:
1357 case SQLCOM_REPLACE_SELECT:1369 case SQLCOM_REPLACE_SELECT:
1358 /*1370 /*
13591371
=== modified file 'drizzled/db.cc'
--- drizzled/db.cc 2010-03-01 23:42:31 +0000
+++ drizzled/db.cc 2010-03-02 21:04:16 +0000
@@ -129,7 +129,7 @@
129 }129 }
130 else // Created !130 else // Created !
131 {131 {
132 replication_services.rawStatement(session, session->query);132 replication_services.createSchema(session, schema_message);
133 session->my_ok(1);133 session->my_ok(1);
134 }134 }
135135
@@ -275,7 +275,7 @@
275 assert(! session->query.empty());275 assert(! session->query.empty());
276276
277 ReplicationServices &replication_services= ReplicationServices::singleton();277 ReplicationServices &replication_services= ReplicationServices::singleton();
278 replication_services.rawStatement(session, session->getQueryString());278 replication_services.dropSchema(session, schema_name);
279 session->clear_error();279 session->clear_error();
280 session->server_status|= SERVER_STATUS_DB_DROPPED;280 session->server_status|= SERVER_STATUS_DB_DROPPED;
281 session->my_ok((uint32_t) deleted);281 session->my_ok((uint32_t) deleted);
282282
=== modified file 'drizzled/join.cc'
--- drizzled/join.cc 2010-02-11 20:01:37 +0000
+++ drizzled/join.cc 2010-03-02 21:04:16 +0000
@@ -337,6 +337,12 @@
337 if (error)337 if (error)
338 goto err;338 goto err;
339339
340 /*
341 * The below will create the new table for
342 * CREATE TABLE ... SELECT
343 *
344 * @see create_table_from_items() in drizzled/sql_insert.cc
345 */
340 if (result && result->prepare(fields_list, unit_arg))346 if (result && result->prepare(fields_list, unit_arg))
341 goto err;347 goto err;
342348
343349
=== modified file 'drizzled/message/statement_transform.cc'
--- drizzled/message/statement_transform.cc 2010-02-08 01:10:03 +0000
+++ drizzled/message/statement_transform.cc 2010-03-02 21:04:16 +0000
@@ -2,10 +2,11 @@
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *3 *
4 * Copyright (C) 2009 Sun Microsystems4 * Copyright (C) 2009 Sun Microsystems
5 * Copyright (c) 2010 Jay Pipes
5 *6 *
6 * Authors:7 * Authors:
7 *8 *
8 * Jay Pipes <joinfu@sun.com>9 * Jay Pipes <jaypipes@gmail.com>
9 *10 *
10 * This program is free software; you can redistribute it and/or modify11 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by12 * it under the terms of the GNU General Public License as published by
@@ -36,23 +37,27 @@
3637
37#include <string>38#include <string>
38#include <vector>39#include <vector>
40#include <sstream>
3941
40using namespace std;42using namespace std;
4143
42namespace drizzled44namespace drizzled
43{45{
4446
45enum message::TransformSqlError47namespace message
46message::transformStatementToSql(const message::Statement &source,48{
47 vector<string> &sql_strings,49
48 enum message::TransformSqlVariant sql_variant,50enum TransformSqlError
49 bool already_in_transaction)51transformStatementToSql(const Statement &source,
50{52 vector<string> &sql_strings,
51 message::TransformSqlError error= NONE;53 enum TransformSqlVariant sql_variant,
54 bool already_in_transaction)
55{
56 TransformSqlError error= NONE;
5257
53 switch (source.type())58 switch (source.type())
54 {59 {
55 case message::Statement::INSERT:60 case Statement::INSERT:
56 {61 {
57 if (! source.has_insert_header())62 if (! source.has_insert_header())
58 {63 {
@@ -65,8 +70,8 @@
65 return error;70 return error;
66 }71 }
6772
68 const message::InsertHeader &insert_header= source.insert_header();73 const InsertHeader &insert_header= source.insert_header();
69 const message::InsertData &insert_data= source.insert_data();74 const InsertData &insert_data= source.insert_data();
70 size_t num_keys= insert_data.record_size();75 size_t num_keys= insert_data.record_size();
71 size_t x;76 size_t x;
7277
@@ -79,7 +84,7 @@
7984
80 error= transformInsertRecordToSql(insert_header,85 error= transformInsertRecordToSql(insert_header,
81 insert_data.record(x),86 insert_data.record(x),
82 &destination,87 destination,
83 sql_variant);88 sql_variant);
84 if (error != NONE)89 if (error != NONE)
85 break;90 break;
@@ -96,7 +101,7 @@
96 }101 }
97 }102 }
98 break;103 break;
99 case message::Statement::UPDATE:104 case Statement::UPDATE:
100 {105 {
101 if (! source.has_update_header())106 if (! source.has_update_header())
102 {107 {
@@ -109,8 +114,8 @@
109 return error;114 return error;
110 }115 }
111116
112 const message::UpdateHeader &update_header= source.update_header();117 const UpdateHeader &update_header= source.update_header();
113 const message::UpdateData &update_data= source.update_data();118 const UpdateData &update_data= source.update_data();
114 size_t num_keys= update_data.record_size();119 size_t num_keys= update_data.record_size();
115 size_t x;120 size_t x;
116121
@@ -123,7 +128,7 @@
123128
124 error= transformUpdateRecordToSql(update_header,129 error= transformUpdateRecordToSql(update_header,
125 update_data.record(x),130 update_data.record(x),
126 &destination,131 destination,
127 sql_variant);132 sql_variant);
128 if (error != NONE)133 if (error != NONE)
129 break;134 break;
@@ -140,7 +145,7 @@
140 }145 }
141 }146 }
142 break;147 break;
143 case message::Statement::DELETE:148 case Statement::DELETE:
144 {149 {
145 if (! source.has_delete_header())150 if (! source.has_delete_header())
146 {151 {
@@ -153,8 +158,8 @@
153 return error;158 return error;
154 }159 }
155160
156 const message::DeleteHeader &delete_header= source.delete_header();161 const DeleteHeader &delete_header= source.delete_header();
157 const message::DeleteData &delete_data= source.delete_data();162 const DeleteData &delete_data= source.delete_data();
158 size_t num_keys= delete_data.record_size();163 size_t num_keys= delete_data.record_size();
159 size_t x;164 size_t x;
160165
@@ -167,7 +172,7 @@
167172
168 error= transformDeleteRecordToSql(delete_header,173 error= transformDeleteRecordToSql(delete_header,
169 delete_data.record(x),174 delete_data.record(x),
170 &destination,175 destination,
171 sql_variant);176 sql_variant);
172 if (error != NONE)177 if (error != NONE)
173 break;178 break;
@@ -184,27 +189,67 @@
184 }189 }
185 }190 }
186 break;191 break;
187 case message::Statement::TRUNCATE_TABLE:192 case Statement::CREATE_TABLE:
193 {
194 assert(source.has_create_table_statement());
195 string destination;
196 error= transformCreateTableStatementToSql(source.create_table_statement(),
197 destination,
198 sql_variant);
199 sql_strings.push_back(destination);
200 }
201 break;
202 case Statement::TRUNCATE_TABLE:
188 {203 {
189 assert(source.has_truncate_table_statement());204 assert(source.has_truncate_table_statement());
190 string destination;205 string destination;
191 error= message::transformTruncateTableStatementToSql(source.truncate_table_statement(),206 error= transformTruncateTableStatementToSql(source.truncate_table_statement(),
192 &destination,207 destination,
193 sql_variant);208 sql_variant);
194 sql_strings.push_back(destination);209 sql_strings.push_back(destination);
195 }210 }
196 break;211 break;
197 case message::Statement::SET_VARIABLE:212 case Statement::DROP_TABLE:
213 {
214 assert(source.has_drop_table_statement());
215 string destination;
216 error= transformDropTableStatementToSql(source.drop_table_statement(),
217 destination,
218 sql_variant);
219 sql_strings.push_back(destination);
220 }
221 break;
222 case Statement::CREATE_SCHEMA:
223 {
224 assert(source.has_create_schema_statement());
225 string destination;
226 error= transformCreateSchemaStatementToSql(source.create_schema_statement(),
227 destination,
228 sql_variant);
229 sql_strings.push_back(destination);
230 }
231 break;
232 case Statement::DROP_SCHEMA:
233 {
234 assert(source.has_drop_schema_statement());
235 string destination;
236 error= transformDropSchemaStatementToSql(source.drop_schema_statement(),
237 destination,
238 sql_variant);
239 sql_strings.push_back(destination);
240 }
241 break;
242 case Statement::SET_VARIABLE:
198 {243 {
199 assert(source.has_set_variable_statement());244 assert(source.has_set_variable_statement());
200 string destination;245 string destination;
201 error= message::transformSetVariableStatementToSql(source.set_variable_statement(),246 error= transformSetVariableStatementToSql(source.set_variable_statement(),
202 &destination,247 destination,
203 sql_variant);248 sql_variant);
204 sql_strings.push_back(destination);249 sql_strings.push_back(destination);
205 }250 }
206 break;251 break;
207 case message::Statement::RAW_SQL:252 case Statement::RAW_SQL:
208 default:253 default:
209 sql_strings.push_back(source.sql());254 sql_strings.push_back(source.sql());
210 break;255 break;
@@ -212,24 +257,24 @@
212 return error;257 return error;
213}258}
214259
215enum message::TransformSqlError260enum TransformSqlError
216message::transformInsertHeaderToSql(const message::InsertHeader &header,261transformInsertHeaderToSql(const InsertHeader &header,
217 std::string *destination,262 string &destination,
218 enum message::TransformSqlVariant sql_variant)263 enum TransformSqlVariant sql_variant)
219{264{
220 char quoted_identifier= '`';265 char quoted_identifier= '`';
221 if (sql_variant == ANSI)266 if (sql_variant == ANSI)
222 quoted_identifier= '"';267 quoted_identifier= '"';
223268
224 destination->assign("INSERT INTO ", 12);269 destination.assign("INSERT INTO ", 12);
225 destination->push_back(quoted_identifier);270 destination.push_back(quoted_identifier);
226 destination->append(header.table_metadata().schema_name());271 destination.append(header.table_metadata().schema_name());
227 destination->push_back(quoted_identifier);272 destination.push_back(quoted_identifier);
228 destination->push_back('.');273 destination.push_back('.');
229 destination->push_back(quoted_identifier);274 destination.push_back(quoted_identifier);
230 destination->append(header.table_metadata().table_name());275 destination.append(header.table_metadata().table_name());
231 destination->push_back(quoted_identifier);276 destination.push_back(quoted_identifier);
232 destination->append(" (", 2);277 destination.append(" (", 2);
233278
234 /* Add field list to SQL string... */279 /* Add field list to SQL string... */
235 size_t num_fields= header.field_metadata_size();280 size_t num_fields= header.field_metadata_size();
@@ -237,33 +282,33 @@
237282
238 for (x= 0; x < num_fields; ++x)283 for (x= 0; x < num_fields; ++x)
239 {284 {
240 const message::FieldMetadata &field_metadata= header.field_metadata(x);285 const FieldMetadata &field_metadata= header.field_metadata(x);
241 if (x != 0)286 if (x != 0)
242 destination->push_back(',');287 destination.push_back(',');
243 288
244 destination->push_back(quoted_identifier);289 destination.push_back(quoted_identifier);
245 destination->append(field_metadata.name());290 destination.append(field_metadata.name());
246 destination->push_back(quoted_identifier);291 destination.push_back(quoted_identifier);
247 }292 }
248293
249 return NONE;294 return NONE;
250}295}
251296
252enum message::TransformSqlError297enum TransformSqlError
253message::transformInsertRecordToSql(const message::InsertHeader &header,298transformInsertRecordToSql(const InsertHeader &header,
254 const message::InsertRecord &record,299 const InsertRecord &record,
255 std::string *destination,300 string &destination,
256 enum message::TransformSqlVariant sql_variant)301 enum TransformSqlVariant sql_variant)
257{302{
258 enum message::TransformSqlError error= transformInsertHeaderToSql(header,303 enum TransformSqlError error= transformInsertHeaderToSql(header,
259 destination,304 destination,
260 sql_variant);305 sql_variant);
261306
262 char quoted_identifier= '`';307 char quoted_identifier= '`';
263 if (sql_variant == ANSI)308 if (sql_variant == ANSI)
264 quoted_identifier= '"';309 quoted_identifier= '"';
265310
266 destination->append(") VALUES (");311 destination.append(") VALUES (");
267312
268 /* Add insert values */313 /* Add insert values */
269 size_t num_fields= header.field_metadata_size();314 size_t num_fields= header.field_metadata_size();
@@ -273,16 +318,16 @@
273 for (x= 0; x < num_fields; ++x)318 for (x= 0; x < num_fields; ++x)
274 {319 {
275 if (x != 0)320 if (x != 0)
276 destination->push_back(',');321 destination.push_back(',');
277322
278 const message::FieldMetadata &field_metadata= header.field_metadata(x);323 const FieldMetadata &field_metadata= header.field_metadata(x);
279324
280 should_quote_field_value= message::shouldQuoteFieldValue(field_metadata.type());325 should_quote_field_value= shouldQuoteFieldValue(field_metadata.type());
281326
282 if (should_quote_field_value)327 if (should_quote_field_value)
283 destination->push_back('\'');328 destination.push_back('\'');
284329
285 if (field_metadata.type() == message::Table::Field::BLOB)330 if (field_metadata.type() == Table::Field::BLOB)
286 {331 {
287 /* 332 /*
288 * We do this here because BLOB data is returned333 * We do this here because BLOB data is returned
@@ -291,36 +336,36 @@
291 * up to a \0 being output here.336 * up to a \0 being output here.
292 */337 */
293 string raw_data(record.insert_value(x));338 string raw_data(record.insert_value(x));
294 destination->append(raw_data.c_str(), raw_data.size());339 destination.append(raw_data.c_str(), raw_data.size());
295 }340 }
296 else341 else
297 {342 {
298 destination->append(record.insert_value(x));343 destination.append(record.insert_value(x));
299 }344 }
300345
301 if (should_quote_field_value)346 if (should_quote_field_value)
302 destination->push_back('\'');347 destination.push_back('\'');
303 }348 }
304 destination->push_back(')');349 destination.push_back(')');
305350
306 return error;351 return error;
307}352}
308353
309enum message::TransformSqlError354enum TransformSqlError
310message::transformInsertStatementToSql(const message::InsertHeader &header,355transformInsertStatementToSql(const InsertHeader &header,
311 const message::InsertData &data,356 const InsertData &data,
312 std::string *destination,357 string &destination,
313 enum message::TransformSqlVariant sql_variant)358 enum TransformSqlVariant sql_variant)
314{359{
315 enum message::TransformSqlError error= transformInsertHeaderToSql(header,360 enum TransformSqlError error= transformInsertHeaderToSql(header,
316 destination,361 destination,
317 sql_variant);362 sql_variant);
318363
319 char quoted_identifier= '`';364 char quoted_identifier= '`';
320 if (sql_variant == ANSI)365 if (sql_variant == ANSI)
321 quoted_identifier= '"';366 quoted_identifier= '"';
322367
323 destination->append(") VALUES (", 10);368 destination.append(") VALUES (", 10);
324369
325 /* Add insert values */370 /* Add insert values */
326 size_t num_records= data.record_size();371 size_t num_records= data.record_size();
@@ -331,21 +376,21 @@
331 for (x= 0; x < num_records; ++x)376 for (x= 0; x < num_records; ++x)
332 {377 {
333 if (x != 0)378 if (x != 0)
334 destination->append("),(", 3);379 destination.append("),(", 3);
335380
336 for (y= 0; y < num_fields; ++y)381 for (y= 0; y < num_fields; ++y)
337 {382 {
338 if (y != 0)383 if (y != 0)
339 destination->push_back(',');384 destination.push_back(',');
340385
341 const message::FieldMetadata &field_metadata= header.field_metadata(y);386 const FieldMetadata &field_metadata= header.field_metadata(y);
342 387
343 should_quote_field_value= message::shouldQuoteFieldValue(field_metadata.type());388 should_quote_field_value= shouldQuoteFieldValue(field_metadata.type());
344389
345 if (should_quote_field_value)390 if (should_quote_field_value)
346 destination->push_back('\'');391 destination.push_back('\'');
347392
348 if (field_metadata.type() == message::Table::Field::BLOB)393 if (field_metadata.type() == Table::Field::BLOB)
349 {394 {
350 /* 395 /*
351 * We do this here because BLOB data is returned396 * We do this here because BLOB data is returned
@@ -354,53 +399,53 @@
354 * up to a \0 being output here.399 * up to a \0 being output here.
355 */400 */
356 string raw_data(data.record(x).insert_value(y));401 string raw_data(data.record(x).insert_value(y));
357 destination->append(raw_data.c_str(), raw_data.size());402 destination.append(raw_data.c_str(), raw_data.size());
358 }403 }
359 else404 else
360 {405 {
361 destination->append(data.record(x).insert_value(y));406 destination.append(data.record(x).insert_value(y));
362 }407 }
363408
364 if (should_quote_field_value)409 if (should_quote_field_value)
365 destination->push_back('\'');410 destination.push_back('\'');
366 }411 }
367 }412 }
368 destination->push_back(')');413 destination.push_back(')');
369414
370 return error;415 return error;
371}416}
372417
373enum message::TransformSqlError418enum TransformSqlError
374message::transformUpdateHeaderToSql(const message::UpdateHeader &header,419transformUpdateHeaderToSql(const UpdateHeader &header,
375 std::string *destination,420 string &destination,
376 enum message::TransformSqlVariant sql_variant)421 enum TransformSqlVariant sql_variant)
377{422{
378 char quoted_identifier= '`';423 char quoted_identifier= '`';
379 if (sql_variant == ANSI)424 if (sql_variant == ANSI)
380 quoted_identifier= '"';425 quoted_identifier= '"';
381426
382 destination->assign("UPDATE ", 7);427 destination.assign("UPDATE ", 7);
383 destination->push_back(quoted_identifier);428 destination.push_back(quoted_identifier);
384 destination->append(header.table_metadata().schema_name());429 destination.append(header.table_metadata().schema_name());
385 destination->push_back(quoted_identifier);430 destination.push_back(quoted_identifier);
386 destination->push_back('.');431 destination.push_back('.');
387 destination->push_back(quoted_identifier);432 destination.push_back(quoted_identifier);
388 destination->append(header.table_metadata().table_name());433 destination.append(header.table_metadata().table_name());
389 destination->push_back(quoted_identifier);434 destination.push_back(quoted_identifier);
390 destination->append(" SET ", 5);435 destination.append(" SET ", 5);
391436
392 return NONE;437 return NONE;
393}438}
394439
395enum message::TransformSqlError440enum TransformSqlError
396message::transformUpdateRecordToSql(const message::UpdateHeader &header,441transformUpdateRecordToSql(const UpdateHeader &header,
397 const message::UpdateRecord &record,442 const UpdateRecord &record,
398 std::string *destination,443 string &destination,
399 enum message::TransformSqlVariant sql_variant)444 enum TransformSqlVariant sql_variant)
400{445{
401 enum message::TransformSqlError error= transformUpdateHeaderToSql(header,446 enum TransformSqlError error= transformUpdateHeaderToSql(header,
402 destination,447 destination,
403 sql_variant);448 sql_variant);
404449
405 char quoted_identifier= '`';450 char quoted_identifier= '`';
406 if (sql_variant == ANSI)451 if (sql_variant == ANSI)
@@ -413,21 +458,21 @@
413458
414 for (x= 0; x < num_set_fields; ++x)459 for (x= 0; x < num_set_fields; ++x)
415 {460 {
416 const message::FieldMetadata &field_metadata= header.set_field_metadata(x);461 const FieldMetadata &field_metadata= header.set_field_metadata(x);
417 if (x != 0)462 if (x != 0)
418 destination->push_back(',');463 destination.push_back(',');
419 464
420 destination->push_back(quoted_identifier);465 destination.push_back(quoted_identifier);
421 destination->append(field_metadata.name());466 destination.append(field_metadata.name());
422 destination->push_back(quoted_identifier);467 destination.push_back(quoted_identifier);
423 destination->push_back('=');468 destination.push_back('=');
424469
425 should_quote_field_value= message::shouldQuoteFieldValue(field_metadata.type());470 should_quote_field_value= shouldQuoteFieldValue(field_metadata.type());
426471
427 if (should_quote_field_value)472 if (should_quote_field_value)
428 destination->push_back('\'');473 destination.push_back('\'');
429474
430 if (field_metadata.type() == message::Table::Field::BLOB)475 if (field_metadata.type() == Table::Field::BLOB)
431 {476 {
432 /* 477 /*
433 * We do this here because BLOB data is returned478 * We do this here because BLOB data is returned
@@ -436,39 +481,39 @@
436 * up to a \0 being output here.481 * up to a \0 being output here.
437 */482 */
438 string raw_data(record.after_value(x));483 string raw_data(record.after_value(x));
439 destination->append(raw_data.c_str(), raw_data.size());484 destination.append(raw_data.c_str(), raw_data.size());
440 }485 }
441 else486 else
442 {487 {
443 destination->append(record.after_value(x));488 destination.append(record.after_value(x));
444 }489 }
445490
446 if (should_quote_field_value)491 if (should_quote_field_value)
447 destination->push_back('\'');492 destination.push_back('\'');
448 }493 }
449494
450 size_t num_key_fields= header.key_field_metadata_size();495 size_t num_key_fields= header.key_field_metadata_size();
451496
452 destination->append(" WHERE ", 7);497 destination.append(" WHERE ", 7);
453 for (x= 0; x < num_key_fields; ++x) 498 for (x= 0; x < num_key_fields; ++x)
454 {499 {
455 const message::FieldMetadata &field_metadata= header.key_field_metadata(x);500 const FieldMetadata &field_metadata= header.key_field_metadata(x);
456 501
457 if (x != 0)502 if (x != 0)
458 destination->append(" AND ", 5); /* Always AND condition with a multi-column PK */503 destination.append(" AND ", 5); /* Always AND condition with a multi-column PK */
459504
460 destination->push_back(quoted_identifier);505 destination.push_back(quoted_identifier);
461 destination->append(field_metadata.name());506 destination.append(field_metadata.name());
462 destination->push_back(quoted_identifier);507 destination.push_back(quoted_identifier);
463508
464 destination->push_back('=');509 destination.push_back('=');
465510
466 should_quote_field_value= message::shouldQuoteFieldValue(field_metadata.type());511 should_quote_field_value= shouldQuoteFieldValue(field_metadata.type());
467512
468 if (should_quote_field_value)513 if (should_quote_field_value)
469 destination->push_back('\'');514 destination.push_back('\'');
470515
471 if (field_metadata.type() == message::Table::Field::BLOB)516 if (field_metadata.type() == Table::Field::BLOB)
472 {517 {
473 /* 518 /*
474 * We do this here because BLOB data is returned519 * We do this here because BLOB data is returned
@@ -477,52 +522,50 @@
477 * up to a \0 being output here.522 * up to a \0 being output here.
478 */523 */
479 string raw_data(record.key_value(x));524 string raw_data(record.key_value(x));
480 destination->append(raw_data.c_str(), raw_data.size());525 destination.append(raw_data.c_str(), raw_data.size());
481 }526 }
482 else527 else
483 {528 {
484 destination->append(record.key_value(x));529 destination.append(record.key_value(x));
485 }530 }
486531
487 if (should_quote_field_value)532 if (should_quote_field_value)
488 destination->push_back('\'');533 destination.push_back('\'');
489 }534 }
490 if (num_key_fields > 1)
491 destination->push_back(')');
492535
493 return error;536 return error;
494}537}
495538
496enum message::TransformSqlError539enum TransformSqlError
497message::transformDeleteHeaderToSql(const message::DeleteHeader &header,540transformDeleteHeaderToSql(const DeleteHeader &header,
498 std::string *destination,541 string &destination,
499 enum message::TransformSqlVariant sql_variant)542 enum TransformSqlVariant sql_variant)
500{543{
501 char quoted_identifier= '`';544 char quoted_identifier= '`';
502 if (sql_variant == ANSI)545 if (sql_variant == ANSI)
503 quoted_identifier= '"';546 quoted_identifier= '"';
504547
505 destination->assign("DELETE FROM ", 12);548 destination.assign("DELETE FROM ", 12);
506 destination->push_back(quoted_identifier);549 destination.push_back(quoted_identifier);
507 destination->append(header.table_metadata().schema_name());550 destination.append(header.table_metadata().schema_name());
508 destination->push_back(quoted_identifier);551 destination.push_back(quoted_identifier);
509 destination->push_back('.');552 destination.push_back('.');
510 destination->push_back(quoted_identifier);553 destination.push_back(quoted_identifier);
511 destination->append(header.table_metadata().table_name());554 destination.append(header.table_metadata().table_name());
512 destination->push_back(quoted_identifier);555 destination.push_back(quoted_identifier);
513556
514 return NONE;557 return NONE;
515}558}
516559
517enum message::TransformSqlError560enum TransformSqlError
518message::transformDeleteRecordToSql(const message::DeleteHeader &header,561transformDeleteRecordToSql(const DeleteHeader &header,
519 const message::DeleteRecord &record,562 const DeleteRecord &record,
520 std::string *destination,563 string &destination,
521 enum message::TransformSqlVariant sql_variant)564 enum TransformSqlVariant sql_variant)
522{565{
523 enum message::TransformSqlError error= transformDeleteHeaderToSql(header,566 enum TransformSqlError error= transformDeleteHeaderToSql(header,
524 destination,567 destination,
525 sql_variant);568 sql_variant);
526 char quoted_identifier= '`';569 char quoted_identifier= '`';
527 if (sql_variant == ANSI)570 if (sql_variant == ANSI)
528 quoted_identifier= '"';571 quoted_identifier= '"';
@@ -532,26 +575,26 @@
532 uint32_t x;575 uint32_t x;
533 bool should_quote_field_value= false;576 bool should_quote_field_value= false;
534577
535 destination->append(" WHERE ", 7);578 destination.append(" WHERE ", 7);
536 for (x= 0; x < num_key_fields; ++x) 579 for (x= 0; x < num_key_fields; ++x)
537 {580 {
538 const message::FieldMetadata &field_metadata= header.key_field_metadata(x);581 const FieldMetadata &field_metadata= header.key_field_metadata(x);
539 582
540 if (x != 0)583 if (x != 0)
541 destination->append(" AND ", 5); /* Always AND condition with a multi-column PK */584 destination.append(" AND ", 5); /* Always AND condition with a multi-column PK */
542585
543 destination->push_back(quoted_identifier);586 destination.push_back(quoted_identifier);
544 destination->append(field_metadata.name());587 destination.append(field_metadata.name());
545 destination->push_back(quoted_identifier);588 destination.push_back(quoted_identifier);
546589
547 destination->push_back('=');590 destination.push_back('=');
548591
549 should_quote_field_value= message::shouldQuoteFieldValue(field_metadata.type());592 should_quote_field_value= shouldQuoteFieldValue(field_metadata.type());
550593
551 if (should_quote_field_value)594 if (should_quote_field_value)
552 destination->push_back('\'');595 destination.push_back('\'');
553596
554 if (field_metadata.type() == message::Table::Field::BLOB)597 if (field_metadata.type() == Table::Field::BLOB)
555 {598 {
556 /* 599 /*
557 * We do this here because BLOB data is returned600 * We do this here because BLOB data is returned
@@ -560,29 +603,29 @@
560 * up to a \0 being output here.603 * up to a \0 being output here.
561 */604 */
562 string raw_data(record.key_value(x));605 string raw_data(record.key_value(x));
563 destination->append(raw_data.c_str(), raw_data.size());606 destination.append(raw_data.c_str(), raw_data.size());
564 }607 }
565 else608 else
566 {609 {
567 destination->append(record.key_value(x));610 destination.append(record.key_value(x));
568 }611 }
569612
570 if (should_quote_field_value)613 if (should_quote_field_value)
571 destination->push_back('\'');614 destination.push_back('\'');
572 }615 }
573616
574 return error;617 return error;
575}618}
576619
577enum message::TransformSqlError620enum TransformSqlError
578message::transformDeleteStatementToSql(const message::DeleteHeader &header,621transformDeleteStatementToSql(const DeleteHeader &header,
579 const message::DeleteData &data,622 const DeleteData &data,
580 std::string *destination,623 string &destination,
581 enum message::TransformSqlVariant sql_variant)624 enum TransformSqlVariant sql_variant)
582{625{
583 enum message::TransformSqlError error= transformDeleteHeaderToSql(header,626 enum TransformSqlError error= transformDeleteHeaderToSql(header,
584 destination,627 destination,
585 sql_variant);628 sql_variant);
586 char quoted_identifier= '`';629 char quoted_identifier= '`';
587 if (sql_variant == ANSI)630 if (sql_variant == ANSI)
588 quoted_identifier= '"';631 quoted_identifier= '"';
@@ -593,34 +636,34 @@
593 uint32_t x, y;636 uint32_t x, y;
594 bool should_quote_field_value= false;637 bool should_quote_field_value= false;
595638
596 destination->append(" WHERE ", 7);639 destination.append(" WHERE ", 7);
597 for (x= 0; x < num_key_records; ++x)640 for (x= 0; x < num_key_records; ++x)
598 {641 {
599 if (x != 0)642 if (x != 0)
600 destination->append(" OR ", 4); /* Always OR condition for multiple key records */643 destination.append(" OR ", 4); /* Always OR condition for multiple key records */
601644
602 if (num_key_fields > 1)645 if (num_key_fields > 1)
603 destination->push_back('(');646 destination.push_back('(');
604647
605 for (y= 0; y < num_key_fields; ++y) 648 for (y= 0; y < num_key_fields; ++y)
606 {649 {
607 const message::FieldMetadata &field_metadata= header.key_field_metadata(y);650 const FieldMetadata &field_metadata= header.key_field_metadata(y);
608 651
609 if (y != 0)652 if (y != 0)
610 destination->append(" AND ", 5); /* Always AND condition with a multi-column PK */653 destination.append(" AND ", 5); /* Always AND condition with a multi-column PK */
611654
612 destination->push_back(quoted_identifier);655 destination.push_back(quoted_identifier);
613 destination->append(field_metadata.name());656 destination.append(field_metadata.name());
614 destination->push_back(quoted_identifier);657 destination.push_back(quoted_identifier);
615658
616 destination->push_back('=');659 destination.push_back('=');
617660
618 should_quote_field_value= message::shouldQuoteFieldValue(field_metadata.type());661 should_quote_field_value= shouldQuoteFieldValue(field_metadata.type());
619662
620 if (should_quote_field_value)663 if (should_quote_field_value)
621 destination->push_back('\'');664 destination.push_back('\'');
622665
623 if (field_metadata.type() == message::Table::Field::BLOB)666 if (field_metadata.type() == Table::Field::BLOB)
624 {667 {
625 /* 668 /*
626 * We do this here because BLOB data is returned669 * We do this here because BLOB data is returned
@@ -629,114 +672,607 @@
629 * up to a \0 being output here.672 * up to a \0 being output here.
630 */673 */
631 string raw_data(data.record(x).key_value(y));674 string raw_data(data.record(x).key_value(y));
632 destination->append(raw_data.c_str(), raw_data.size());675 destination.append(raw_data.c_str(), raw_data.size());
633 }676 }
634 else677 else
635 {678 {
636 destination->append(data.record(x).key_value(y));679 destination.append(data.record(x).key_value(y));
637 }680 }
638681
639 if (should_quote_field_value)682 if (should_quote_field_value)
640 destination->push_back('\'');683 destination.push_back('\'');
641 }684 }
642 if (num_key_fields > 1)685 if (num_key_fields > 1)
643 destination->push_back(')');686 destination.push_back(')');
644 }687 }
645 return error;688 return error;
646}689}
647690
648enum message::TransformSqlError691enum TransformSqlError
649message::transformTruncateTableStatementToSql(const message::TruncateTableStatement &statement,692transformDropSchemaStatementToSql(const DropSchemaStatement &statement,
650 std::string *destination,693 string &destination,
651 enum message::TransformSqlVariant sql_variant)694 enum TransformSqlVariant sql_variant)
652{695{
653 char quoted_identifier= '`';696 char quoted_identifier= '`';
654 if (sql_variant == ANSI)697 if (sql_variant == ANSI)
655 quoted_identifier= '"';698 quoted_identifier= '"';
656699
657 const message::TableMetadata &table_metadata= statement.table_metadata();700 destination.append("DROP SCHEMA ", 12);
658701 destination.push_back(quoted_identifier);
659 destination->append("TRUNCATE TABLE ", 15);702 destination.append(statement.schema_name());
660 destination->push_back(quoted_identifier);703 destination.push_back(quoted_identifier);
661 destination->append(table_metadata.schema_name());704
662 destination->push_back(quoted_identifier);705 return NONE;
663 destination->push_back('.');706}
664 destination->push_back(quoted_identifier);707
665 destination->append(table_metadata.table_name());708enum TransformSqlError
666 destination->push_back(quoted_identifier);709transformCreateSchemaStatementToSql(const CreateSchemaStatement &statement,
667710 string &destination,
668 return NONE;711 enum TransformSqlVariant sql_variant)
669}712{
670713 char quoted_identifier= '`';
671enum message::TransformSqlError714 if (sql_variant == ANSI)
672message::transformSetVariableStatementToSql(const message::SetVariableStatement &statement,715 quoted_identifier= '"';
673 std::string *destination,716
674 enum message::TransformSqlVariant sql_variant)717 const Schema &schema= statement.schema();
718
719 destination.append("CREATE SCHEMA ", 14);
720 destination.push_back(quoted_identifier);
721 destination.append(schema.name());
722 destination.push_back(quoted_identifier);
723
724 if (schema.has_collation())
725 {
726 destination.append(" COLLATE ", 9);
727 destination.append(schema.collation());
728 }
729
730 return NONE;
731}
732
733enum TransformSqlError
734transformDropTableStatementToSql(const DropTableStatement &statement,
735 string &destination,
736 enum TransformSqlVariant sql_variant)
737{
738 char quoted_identifier= '`';
739 if (sql_variant == ANSI)
740 quoted_identifier= '"';
741
742 const TableMetadata &table_metadata= statement.table_metadata();
743
744 destination.append("DROP TABLE ", 11);
745
746 /* Add the IF EXISTS clause if necessary */
747 if (statement.has_if_exists_clause() &&
748 statement.if_exists_clause() == true)
749 {
750 destination.append("IF EXISTS ", 10);
751 }
752
753 destination.push_back(quoted_identifier);
754 destination.append(table_metadata.schema_name());
755 destination.push_back(quoted_identifier);
756 destination.push_back('.');
757 destination.push_back(quoted_identifier);
758 destination.append(table_metadata.table_name());
759 destination.push_back(quoted_identifier);
760
761 return NONE;
762}
763
764enum TransformSqlError
765transformTruncateTableStatementToSql(const TruncateTableStatement &statement,
766 string &destination,
767 enum TransformSqlVariant sql_variant)
768{
769 char quoted_identifier= '`';
770 if (sql_variant == ANSI)
771 quoted_identifier= '"';
772
773 const TableMetadata &table_metadata= statement.table_metadata();
774
775 destination.append("TRUNCATE TABLE ", 15);
776 destination.push_back(quoted_identifier);
777 destination.append(table_metadata.schema_name());
778 destination.push_back(quoted_identifier);
779 destination.push_back('.');
780 destination.push_back(quoted_identifier);
781 destination.append(table_metadata.table_name());
782 destination.push_back(quoted_identifier);
783
784 return NONE;
785}
786
787enum TransformSqlError
788transformSetVariableStatementToSql(const SetVariableStatement &statement,
789 string &destination,
790 enum TransformSqlVariant sql_variant)
675{791{
676 (void) sql_variant;792 (void) sql_variant;
677 const message::FieldMetadata &variable_metadata= statement.variable_metadata();793 const FieldMetadata &variable_metadata= statement.variable_metadata();
678 bool should_quote_field_value= message::shouldQuoteFieldValue(variable_metadata.type());794 bool should_quote_field_value= shouldQuoteFieldValue(variable_metadata.type());
679795
680 destination->append("SET GLOBAL ", 11); /* Only global variables are replicated */796 destination.append("SET GLOBAL ", 11); /* Only global variables are replicated */
681 destination->append(variable_metadata.name());797 destination.append(variable_metadata.name());
682 destination->push_back('=');798 destination.push_back('=');
683799
684 if (should_quote_field_value)800 if (should_quote_field_value)
685 destination->push_back('\'');801 destination.push_back('\'');
686 802
687 destination->append(statement.variable_value());803 destination.append(statement.variable_value());
688804
689 if (should_quote_field_value)805 if (should_quote_field_value)
690 destination->push_back('\'');806 destination.push_back('\'');
691807
692 return NONE;808 return NONE;
693}809}
694810
695bool message::shouldQuoteFieldValue(message::Table::Field::FieldType in_type)811enum TransformSqlError
812transformCreateTableStatementToSql(const CreateTableStatement &statement,
813 string &destination,
814 enum TransformSqlVariant sql_variant)
815{
816 return transformTableDefinitionToSql(statement.table(), destination, sql_variant);
817}
818
819enum TransformSqlError
820transformTableDefinitionToSql(const Table &table,
821 string &destination,
822 enum TransformSqlVariant sql_variant)
823{
824 char quoted_identifier= '`';
825 if (sql_variant == ANSI)
826 quoted_identifier= '"';
827
828 destination.append("CREATE ", 7);
829
830 if (table.type() == Table::TEMPORARY)
831 destination.append("TEMPORARY ", 10);
832
833 destination.append("TABLE ", 6);
834 destination.push_back(quoted_identifier);
835 destination.append(table.name());
836 destination.push_back(quoted_identifier);
837 destination.append(" (\n", 3);
838
839 enum TransformSqlError result= NONE;
840 size_t num_fields= table.field_size();
841 for (size_t x= 0; x < num_fields; ++x)
842 {
843 const Table::Field &field= table.field(x);
844
845 if (x != 0)
846 destination.append(",\n", 2);
847
848 result= transformFieldDefinitionToSql(field, destination, sql_variant);
849
850 if (result != NONE)
851 return result;
852 }
853
854 size_t num_indexes= table.indexes_size();
855
856 if (num_indexes > 0)
857 destination.append(",\n", 2);
858
859 for (size_t x= 0; x < num_indexes; ++x)
860 {
861 const message::Table::Index &index= table.indexes(x);
862
863 if (x != 0)
864 destination.append(",\n", 2);
865
866 result= transformIndexDefinitionToSql(index, table, destination, sql_variant);
867
868 if (result != NONE)
869 return result;
870 }
871 destination.append("\n)", 2);
872
873 /* Add ENGINE = " clause */
874 if (table.has_engine())
875 {
876 const Table::StorageEngine &engine= table.engine();
877 destination.append("\nENGINE = ", 10);
878 destination.append(engine.name());
879
880 size_t num_engine_options= engine.option_size();
881 for (size_t x= 0; x < num_engine_options; ++x)
882 {
883 const Table::StorageEngine::EngineOption &option= engine.option(x);
884 destination.push_back('\n');
885 destination.append(option.option_name());
886 destination.append(" = ", 3);
887 destination.append(option.option_value());
888 destination.push_back('\n');
889 }
890 }
891
892 if (table.has_options())
893 (void) transformTableOptionsToSql(table.options(), destination, sql_variant);
894
895 return NONE;
896}
897
898enum TransformSqlError
899transformTableOptionsToSql(const Table::TableOptions &options,
900 string &destination,
901 enum TransformSqlVariant sql_variant)
902{
903 if (sql_variant == ANSI)
904 return NONE; /* ANSI does not support table options... */
905
906 stringstream ss;
907
908 if (options.has_comment())
909 {
910 destination.append("\nCOMMENT = '", 12);
911 destination.append(options.comment());
912 destination.push_back('\'');
913 }
914
915 if (options.has_collation())
916 {
917 destination.append("\nCOLLATE = ", 11);
918 destination.append(options.collation());
919 }
920
921 if (options.has_auto_increment())
922 {
923 ss << options.auto_increment();
924 destination.append("\nAUTOINCREMENT_OFFSET = ", 24);
925 destination.append(ss.str());
926 ss.clear();
927 }
928
929 if (options.has_row_type())
930 {
931 ss << options.row_type();
932 destination.append("\nROW_TYPE = ", 12);
933 destination.append(ss.str());
934 ss.clear();
935 }
936
937 if (options.has_data_file_name())
938 {
939 destination.append("\nDATA_FILE_NAME = '", 19);
940 destination.append(options.data_file_name());
941 destination.push_back('\'');
942 }
943
944 if (options.has_index_file_name())
945 {
946 destination.append("\nINDEX_FILE_NAME = '", 20);
947 destination.append(options.index_file_name());
948 destination.push_back('\'');
949 }
950
951 if (options.has_max_rows())
952 {
953 ss << options.max_rows();
954 destination.append("\nMAX_ROWS = ", 12);
955 destination.append(ss.str());
956 ss.clear();
957 }
958
959 if (options.has_min_rows())
960 {
961 ss << options.min_rows();
962 destination.append("\nMIN_ROWS = ", 12);
963 destination.append(ss.str());
964 ss.clear();
965 }
966
967 if (options.has_auto_increment_value())
968 {
969 ss << options.auto_increment_value();
970 destination.append("\nAUTO_INCREMENT = ", 18);
971 destination.append(ss.str());
972 ss.clear();
973 }
974
975 if (options.has_avg_row_length())
976 {
977 ss << options.avg_row_length();
978 destination.append("\nAVG_ROW_LENGTH = ", 18);
979 destination.append(ss.str());
980 ss.clear();
981 }
982
983 if (options.has_key_block_size())
984 {
985 ss << options.key_block_size();
986 destination.append("\nKEY_BLOCK_SIZE = ", 18);
987 destination.append(ss.str());
988 ss.clear();
989 }
990
991 if (options.has_block_size())
992 {
993 ss << options.block_size();
994 destination.append("\nBLOCK_SIZE = ", 14);
995 destination.append(ss.str());
996 ss.clear();
997 }
998
999 if (options.has_pack_keys() &&
1000 options.pack_keys())
1001 destination.append("\nPACK_KEYS = TRUE", 17);
1002 if (options.has_pack_record() &&
1003 options.pack_record())
1004 destination.append("\nPACK_RECORD = TRUE", 19);
1005 if (options.has_checksum() &&
1006 options.checksum())
1007 destination.append("\nCHECKSUM = TRUE", 16);
1008 if (options.has_page_checksum() &&
1009 options.page_checksum())
1010 destination.append("\nPAGE_CHECKSUM = TRUE", 21);
1011
1012 return NONE;
1013}
1014
1015enum TransformSqlError
1016transformIndexDefinitionToSql(const Table::Index &index,
1017 const Table &table,
1018 string &destination,
1019 enum TransformSqlVariant sql_variant)
1020{
1021 char quoted_identifier= '`';
1022 if (sql_variant == ANSI)
1023 quoted_identifier= '"';
1024
1025 if (index.is_primary())
1026 destination.append("PRIMARY ", 8);
1027 else if (index.is_unique())
1028 destination.append("UNIQUE ", 7);
1029
1030 destination.append("KEY ", 4);
1031 destination.push_back(quoted_identifier);
1032 destination.append(index.name());
1033 destination.push_back(quoted_identifier);
1034 destination.append(" (", 2);
1035
1036 size_t num_parts= index.index_part_size();
1037 for (size_t x= 0; x < num_parts; ++x)
1038 {
1039 const Table::Index::IndexPart &part= index.index_part(x);
1040 const Table::Field &field= table.field(part.fieldnr());
1041
1042 if (x != 0)
1043 destination.push_back(',');
1044
1045 destination.push_back(quoted_identifier);
1046 destination.append(field.name());
1047 destination.push_back(quoted_identifier);
1048
1049 /*
1050 * If the index part's field type is VARCHAR or TEXT
1051 * then check for a prefix length then is different
1052 * from the field's full length...
1053 */
1054 if (field.type() == Table::Field::VARCHAR ||
1055 field.type() == Table::Field::BLOB)
1056 {
1057 if (part.has_compare_length())
1058 {
1059 size_t compare_length_in_chars= part.compare_length();
1060
1061 /* hack: compare_length() is bytes, not chars, but
1062 * only for VARCHAR. Ass. */
1063 if (field.type() == Table::Field::VARCHAR)
1064 compare_length_in_chars/= 4;
1065
1066 if (compare_length_in_chars != field.string_options().length())
1067 {
1068 stringstream ss;
1069 destination.push_back('(');
1070 ss << compare_length_in_chars;
1071 destination.append(ss.str());
1072 destination.push_back(')');
1073 }
1074 }
1075 }
1076 }
1077 destination.push_back(')');
1078
1079 return NONE;
1080}
1081
1082enum TransformSqlError
1083transformFieldDefinitionToSql(const Table::Field &field,
1084 string &destination,
1085 enum TransformSqlVariant sql_variant)
1086{
1087 char quoted_identifier= '`';
1088 if (sql_variant == ANSI)
1089 quoted_identifier= '"';
1090
1091 destination.push_back(quoted_identifier);
1092 destination.append(field.name());
1093 destination.push_back(quoted_identifier);
1094
1095 Table::Field::FieldType field_type= field.type();
1096
1097 switch (field_type)
1098 {
1099 case Table::Field::DOUBLE:
1100 destination.append(" DOUBLE", 7);
1101 break;
1102 case Table::Field::VARCHAR:
1103 {
1104 destination.append(" VARCHAR(", 9);
1105 stringstream ss;
1106 ss << field.string_options().length() << ")";
1107 destination.append(ss.str());
1108 }
1109 break;
1110 case Table::Field::BLOB:
1111 destination.append(" BLOB", 5);
1112 break;
1113 case Table::Field::ENUM:
1114 {
1115 size_t num_field_values= field.set_options().field_value_size();
1116 destination.append(" ENUM(", 6);
1117 for (size_t x= 0; x < num_field_values; ++x)
1118 {
1119 const string &type= field.set_options().field_value(x);
1120
1121 if (x != 0)
1122 destination.push_back(',');
1123
1124 destination.push_back('\'');
1125 destination.append(type);
1126 destination.push_back('\'');
1127 }
1128 destination.push_back(')');
1129 break;
1130 }
1131 case Table::Field::INTEGER:
1132 destination.append(" INT", 4);
1133 break;
1134 case Table::Field::BIGINT:
1135 destination.append(" BIGINT", 7);
1136 break;
1137 case Table::Field::DECIMAL:
1138 {
1139 destination.append(" DECIMAL(", 9);
1140 stringstream ss;
1141 ss << field.numeric_options().precision() << ",";
1142 ss << field.numeric_options().scale() << ")";
1143 destination.append(ss.str());
1144 }
1145 break;
1146 case Table::Field::DATE:
1147 destination.append(" DATE", 5);
1148 break;
1149 case Table::Field::TIMESTAMP:
1150 destination.append(" TIMESTAMP", 10);
1151 break;
1152 case Table::Field::DATETIME:
1153 destination.append(" DATETIME", 9);
1154 break;
1155 }
1156
1157 if (field.type() == Table::Field::INTEGER ||
1158 field.type() == Table::Field::BIGINT)
1159 {
1160 if (field.has_constraints() &&
1161 field.constraints().has_is_unsigned() &&
1162 field.constraints().is_unsigned())
1163 {
1164 destination.append(" UNSIGNED", 9);
1165 }
1166 }
1167
1168
1169 if (! (field.has_constraints() &&
1170 field.constraints().is_nullable()))
1171 {
1172 destination.append(" NOT", 4);
1173 }
1174 destination.append(" NULL", 5);
1175
1176 if (field.type() == Table::Field::INTEGER ||
1177 field.type() == Table::Field::BIGINT)
1178 {
1179 /* AUTO_INCREMENT must be after NOT NULL */
1180 if (field.has_numeric_options() &&
1181 field.numeric_options().is_autoincrement())
1182 {
1183 destination.append(" AUTO_INCREMENT", 15);
1184 }
1185 }
1186
1187 if (field.type() == Table::Field::BLOB ||
1188 field.type() == Table::Field::VARCHAR)
1189 {
1190 if (field.string_options().has_collation())
1191 {
1192 destination.append(" COLLATE ", 9);
1193 destination.append(field.string_options().collation());
1194 }
1195 }
1196
1197 if (field.options().has_default_value())
1198 {
1199 destination.append(" DEFAULT ", 9);
1200 destination.push_back(quoted_identifier);
1201 destination.append(field.options().default_value());
1202 destination.push_back(quoted_identifier);
1203 }
1204
1205 if (field.options().has_default_bin_value())
1206 {
1207 const string &v= field.options().default_bin_value();
1208 destination.append(" DEFAULT 0x", 11);
1209 for (size_t x= 0; x < v.length(); x++)
1210 {
1211 printf("%.2x", *(v.c_str() + x));
1212 }
1213 }
1214
1215 if (field.type() == Table::Field::TIMESTAMP)
1216 if (field.timestamp_options().has_auto_updates() &&
1217 field.timestamp_options().auto_updates())
1218 destination.append(" ON UPDATE CURRENT_TIMESTAMP", 28);
1219
1220 if (field.has_comment())
1221 {
1222 destination.append(" COMMENT ", 9);
1223 destination.push_back(quoted_identifier);
1224 destination.append(field.comment());
1225 destination.push_back(quoted_identifier);
1226 }
1227 return NONE;
1228}
1229
1230bool shouldQuoteFieldValue(Table::Field::FieldType in_type)
696{1231{
697 switch (in_type)1232 switch (in_type)
698 {1233 {
699 case message::Table::Field::DOUBLE:1234 case Table::Field::DOUBLE:
700 case message::Table::Field::DECIMAL:1235 case Table::Field::DECIMAL:
701 case message::Table::Field::INTEGER:1236 case Table::Field::INTEGER:
702 case message::Table::Field::BIGINT:1237 case Table::Field::BIGINT:
703 case message::Table::Field::ENUM:1238 case Table::Field::ENUM:
704 return false;1239 return false;
705 default:1240 default:
706 return true;1241 return true;
707 } 1242 }
708}1243}
7091244
710drizzled::message::Table::Field::FieldType message::internalFieldTypeToFieldProtoType(enum enum_field_types type)1245Table::Field::FieldType internalFieldTypeToFieldProtoType(enum enum_field_types type)
711{1246{
712 switch (type) {1247 switch (type) {
713 case DRIZZLE_TYPE_LONG:1248 case DRIZZLE_TYPE_LONG:
714 return message::Table::Field::INTEGER;1249 return Table::Field::INTEGER;
715 case DRIZZLE_TYPE_DOUBLE:1250 case DRIZZLE_TYPE_DOUBLE:
716 return message::Table::Field::DOUBLE;1251 return Table::Field::DOUBLE;
717 case DRIZZLE_TYPE_NULL:1252 case DRIZZLE_TYPE_NULL:
718 assert(false); /* Not a user definable type */1253 assert(false); /* Not a user definable type */
719 return message::Table::Field::INTEGER; /* unreachable */1254 return Table::Field::INTEGER; /* unreachable */
720 case DRIZZLE_TYPE_TIMESTAMP:1255 case DRIZZLE_TYPE_TIMESTAMP:
721 return message::Table::Field::TIMESTAMP;1256 return Table::Field::TIMESTAMP;
722 case DRIZZLE_TYPE_LONGLONG:1257 case DRIZZLE_TYPE_LONGLONG:
723 return message::Table::Field::BIGINT;1258 return Table::Field::BIGINT;
724 case DRIZZLE_TYPE_DATETIME:1259 case DRIZZLE_TYPE_DATETIME:
725 return message::Table::Field::DATETIME;1260 return Table::Field::DATETIME;
726 case DRIZZLE_TYPE_DATE:1261 case DRIZZLE_TYPE_DATE:
727 return message::Table::Field::DATE;1262 return Table::Field::DATE;
728 case DRIZZLE_TYPE_VARCHAR:1263 case DRIZZLE_TYPE_VARCHAR:
729 return message::Table::Field::VARCHAR;1264 return Table::Field::VARCHAR;
730 case DRIZZLE_TYPE_DECIMAL:1265 case DRIZZLE_TYPE_DECIMAL:
731 return message::Table::Field::DECIMAL;1266 return Table::Field::DECIMAL;
732 case DRIZZLE_TYPE_ENUM:1267 case DRIZZLE_TYPE_ENUM:
733 return message::Table::Field::ENUM;1268 return Table::Field::ENUM;
734 case DRIZZLE_TYPE_BLOB:1269 case DRIZZLE_TYPE_BLOB:
735 return message::Table::Field::BLOB;1270 return Table::Field::BLOB;
736 }1271 }
7371272
738 assert(false);1273 assert(false);
739 return message::Table::Field::INTEGER; /* unreachable */1274 return Table::Field::INTEGER; /* unreachable */
740}1275}
7411276
1277} /* namespace message */
742} /* namespace drizzled */1278} /* namespace drizzled */
7431279
=== modified file 'drizzled/message/statement_transform.h'
--- drizzled/message/statement_transform.h 2010-02-08 01:10:03 +0000
+++ drizzled/message/statement_transform.h 2010-03-02 21:04:16 +0000
@@ -2,10 +2,11 @@
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *3 *
4 * Copyright (C) 2009 Sun Microsystems4 * Copyright (C) 2009 Sun Microsystems
5 * Copyright (c) 2010 Jay Pipes <jayjpipes@gmail.com>
5 *6 *
6 * Authors:7 * Authors:
7 *8 *
8 * Jay Pipes <joinfu@sun.com>9 * Jay Pipes <jaypipes@gmail.com>
9 *10 *
10 * This program is free software; you can redistribute it and/or modify11 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by12 * it under the terms of the GNU General Public License as published by
@@ -52,7 +53,11 @@
52class DeleteHeader;53class DeleteHeader;
53class DeleteData;54class DeleteData;
54class DeleteRecord;55class DeleteRecord;
56class DropTableStatement;
57class CreateTableStatement;
55class TruncateTableStatement;58class TruncateTableStatement;
59class CreateSchemaStatement;
60class DropSchemaStatement;
56class SetVariableStatement;61class SetVariableStatement;
5762
58/** A Variation of SQL to be output during transformation */63/** A Variation of SQL to be output during transformation */
@@ -117,7 +122,7 @@
117enum TransformSqlError122enum TransformSqlError
118transformInsertStatementToSql(const InsertHeader &header,123transformInsertStatementToSql(const InsertHeader &header,
119 const InsertData &data,124 const InsertData &data,
120 std::string *destination,125 std::string &destination,
121 enum TransformSqlVariant sql_variant= DRIZZLE);126 enum TransformSqlVariant sql_variant= DRIZZLE);
122127
123/**128/**
@@ -138,7 +143,7 @@
138enum TransformSqlError143enum TransformSqlError
139transformInsertRecordToSql(const InsertHeader &header,144transformInsertRecordToSql(const InsertHeader &header,
140 const InsertRecord &record,145 const InsertRecord &record,
141 std::string *destination,146 std::string &destination,
142 enum TransformSqlVariant sql_variant= DRIZZLE);147 enum TransformSqlVariant sql_variant= DRIZZLE);
143148
144/**149/**
@@ -156,7 +161,7 @@
156 */161 */
157enum TransformSqlError162enum TransformSqlError
158transformInsertHeaderToSql(const InsertHeader &header,163transformInsertHeaderToSql(const InsertHeader &header,
159 std::string *destination,164 std::string &destination,
160 enum TransformSqlVariant sql_variant= DRIZZLE);165 enum TransformSqlVariant sql_variant= DRIZZLE);
161166
162/**167/**
@@ -174,7 +179,7 @@
174 */179 */
175enum TransformSqlError180enum TransformSqlError
176transformUpdateHeaderToSql(const UpdateHeader &header,181transformUpdateHeaderToSql(const UpdateHeader &header,
177 std::string *destination,182 std::string &destination,
178 enum TransformSqlVariant sql_variant= DRIZZLE);183 enum TransformSqlVariant sql_variant= DRIZZLE);
179184
180/**185/**
@@ -195,7 +200,7 @@
195enum TransformSqlError200enum TransformSqlError
196transformUpdateRecordToSql(const UpdateHeader &header,201transformUpdateRecordToSql(const UpdateHeader &header,
197 const UpdateRecord &record,202 const UpdateRecord &record,
198 std::string *destination,203 std::string &destination,
199 enum TransformSqlVariant sql_variant= DRIZZLE);204 enum TransformSqlVariant sql_variant= DRIZZLE);
200205
201/**206/**
@@ -221,7 +226,7 @@
221enum TransformSqlError226enum TransformSqlError
222transformDeleteStatementToSql(const DeleteHeader &header,227transformDeleteStatementToSql(const DeleteHeader &header,
223 const DeleteData &data,228 const DeleteData &data,
224 std::string *destination,229 std::string &destination,
225 enum TransformSqlVariant sql_variant= DRIZZLE);230 enum TransformSqlVariant sql_variant= DRIZZLE);
226231
227/**232/**
@@ -242,7 +247,7 @@
242enum TransformSqlError247enum TransformSqlError
243transformDeleteRecordToSql(const DeleteHeader &header,248transformDeleteRecordToSql(const DeleteHeader &header,
244 const DeleteRecord &record,249 const DeleteRecord &record,
245 std::string *destination,250 std::string &destination,
246 enum TransformSqlVariant sql_variant= DRIZZLE);251 enum TransformSqlVariant sql_variant= DRIZZLE);
247252
248/**253/**
@@ -260,10 +265,29 @@
260 */265 */
261enum TransformSqlError266enum TransformSqlError
262transformDeleteHeaderToSql(const DeleteHeader &header,267transformDeleteHeaderToSql(const DeleteHeader &header,
263 std::string *destination,268 std::string &destination,
264 enum TransformSqlVariant sql_variant= DRIZZLE);269 enum TransformSqlVariant sql_variant= DRIZZLE);
265270
266/**271/**
272 * This function looks at a supplied DropTableStatement
273 * and constructs a correctly-formatted SQL
274 * statement to the supplied destination string.
275 *
276 * @param DropTableStatement message to transform
277 * @param Destination string to append SQL to
278 * @param Variation of SQL to generate
279 *
280 * @retval
281 * NONE if successful transformation
282 * @retval
283 * Error code (see enum TransformSqlError definition) if failure
284 */
285enum TransformSqlError
286transformDropTableStatementToSql(const DropTableStatement &statement,
287 std::string &destination,
288 enum TransformSqlVariant sql_variant= DRIZZLE);
289
290/**
267 * This function looks at a supplied TruncateTableStatement291 * This function looks at a supplied TruncateTableStatement
268 * and constructs a correctly-formatted SQL292 * and constructs a correctly-formatted SQL
269 * statement to the supplied destination string.293 * statement to the supplied destination string.
@@ -279,10 +303,48 @@
279 */303 */
280enum TransformSqlError304enum TransformSqlError
281transformTruncateTableStatementToSql(const TruncateTableStatement &statement,305transformTruncateTableStatementToSql(const TruncateTableStatement &statement,
282 std::string *destination,306 std::string &destination,
283 enum TransformSqlVariant sql_variant= DRIZZLE);307 enum TransformSqlVariant sql_variant= DRIZZLE);
284308
285/**309/**
310 * This function looks at a supplied CreateSchemaStatement
311 * and constructs a correctly-formatted SQL
312 * statement to the supplied destination string.
313 *
314 * @param CreateSchemaStatement message to transform
315 * @param Destination string to append SQL to
316 * @param Variation of SQL to generate
317 *
318 * @retval
319 * NONE if successful transformation
320 * @retval
321 * Error code (see enum TransformSqlError definition) if failure
322 */
323enum TransformSqlError
324transformCreateSchemaStatementToSql(const CreateSchemaStatement &statement,
325 std::string &destination,
326 enum TransformSqlVariant sql_variant= DRIZZLE);
327
328/**
329 * This function looks at a supplied DropSchemaStatement
330 * and constructs a correctly-formatted SQL
331 * statement to the supplied destination string.
332 *
333 * @param DropSchemaStatement message to transform
334 * @param Destination string to append SQL to
335 * @param Variation of SQL to generate
336 *
337 * @retval
338 * NONE if successful transformation
339 * @retval
340 * Error code (see enum TransformSqlError definition) if failure
341 */
342enum TransformSqlError
343transformDropSchemaStatementToSql(const DropSchemaStatement &statement,
344 std::string &destination,
345 enum TransformSqlVariant sql_variant= DRIZZLE);
346
347/**
286 * This function looks at a supplied SetVariableStatement348 * This function looks at a supplied SetVariableStatement
287 * and constructs a correctly-formatted SQL349 * and constructs a correctly-formatted SQL
288 * statement to the supplied destination string.350 * statement to the supplied destination string.
@@ -298,9 +360,95 @@
298 */360 */
299enum TransformSqlError361enum TransformSqlError
300transformSetVariableStatementToSql(const SetVariableStatement &statement,362transformSetVariableStatementToSql(const SetVariableStatement &statement,
301 std::string *destination,363 std::string &destination,
302 enum TransformSqlVariant sql_variant= DRIZZLE);364 enum TransformSqlVariant sql_variant= DRIZZLE);
303365
366/**
367 * Appends to supplied string an SQL expression
368 * containing the supplied CreateTableStatement's
369 * appropriate CREATE TABLE SQL statement.
370 */
371enum TransformSqlError
372transformCreateTableStatementToSql(const CreateTableStatement &statement,
373 std::string &destination,
374 enum TransformSqlVariant sql_variant= DRIZZLE);
375
376/**
377 * Appends to the supplied string an SQL expression
378 * representing the table for a CREATE TABLE expression.
379 *
380 * @param[in] Table message
381 * @param[out] String to append to
382 *
383 * @retval
384 * NONE if successful transformation
385 * @retval
386 * Error code (see enum TransformSqlError definition) if failure
387 */
388enum TransformSqlError
389transformTableDefinitionToSql(const Table &table,
390 std::string &destination,
391 enum TransformSqlVariant sql_variant= DRIZZLE);
392
393/**
394 * Appends to the supplied string an SQL expression
395 * representing the table's optional attributes.
396 *
397 * @note
398 *
399 * This function will eventually be a much simpler
400 * listing of key/value pairs.
401 *
402 * @param[in] TableOptions message
403 * @param[out] String to append to
404 *
405 * @retval
406 * NONE if successful transformation
407 * @retval
408 * Error code (see enum TransformSqlError definition) if failure
409 */
410enum TransformSqlError
411transformTableOptionsToSql(const Table::TableOptions &table_options,
412 std::string &destination,
413 enum TransformSqlVariant sql_variant= DRIZZLE);
414
415/**
416 * Appends to the supplied string an SQL expression
417 * representing the index's attributes. The built string
418 * corresponds to the SQL in a CREATE INDEX statement.
419 *
420 * @param[in] Index message
421 * @param[in] Table containing this index (used to get field names...)
422 * @param[out] String to append to
423 *
424 * @retval
425 * NONE if successful transformation
426 * @retval
427 * Error code (see enum TransformSqlError definition) if failure
428 */
429enum TransformSqlError
430transformIndexDefinitionToSql(const Table::Index &index,
431 const Table &table,
432 std::string &destination,
433 enum TransformSqlVariant sql_variant= DRIZZLE);
434
435/**
436 * Appends to the supplied string an SQL expression
437 * representing the field's attributes. The built string
438 * corresponds to the SQL in a CREATE TABLE statement.
439 *
440 * @param[in] Field message
441 * @param[out] String to append to
442 *
443 * @retval
444 * NONE if successful transformation
445 * @retval
446 * Error code (see enum TransformSqlError definition) if failure
447 */
448enum TransformSqlError
449transformFieldDefinitionToSql(const Table::Field &field,
450 std::string &destination,
451 enum TransformSqlVariant sql_variant= DRIZZLE);
304452
305/**453/**
306 * Returns true if the supplied message::Table::Field::FieldType454 * Returns true if the supplied message::Table::Field::FieldType
307455
=== modified file 'drizzled/message/table.proto'
--- drizzled/message/table.proto 2010-02-16 01:28:56 +0000
+++ drizzled/message/table.proto 2010-03-02 21:04:16 +0000
@@ -157,7 +157,7 @@
157157
158 message IndexPart {158 message IndexPart {
159 required uint32 fieldnr = 1;159 required uint32 fieldnr = 1;
160 optional int32 compare_length = 2;160 optional uint32 compare_length = 2;
161 optional bool in_reverse_order = 3 [default = false];161 optional bool in_reverse_order = 3 [default = false];
162162
163 optional uint32 key_type = 101; /* THIS MUST DIE. Along with pack_flag*/163 optional uint32 key_type = 101; /* THIS MUST DIE. Along with pack_flag*/
164164
=== modified file 'drizzled/message/table_reader.cc'
--- drizzled/message/table_reader.cc 2010-02-16 01:28:56 +0000
+++ drizzled/message/table_reader.cc 2010-03-02 21:04:16 +0000
@@ -30,7 +30,7 @@
3030
31#include <iostream>31#include <iostream>
32#include <string>32#include <string>
33#include <drizzled/message/table.pb.h>33#include <drizzled/message/statement_transform.h>
34#include <google/protobuf/io/zero_copy_stream.h>34#include <google/protobuf/io/zero_copy_stream.h>
35#include <google/protobuf/io/zero_copy_stream_impl.h>35#include <google/protobuf/io/zero_copy_stream_impl.h>
3636
@@ -42,246 +42,6 @@
42 Written from Google proto example42 Written from Google proto example
43*/43*/
4444
45static void print_field(const message::Table::Field &field)
46{
47 cout << "\t`" << field.name() << "`";
48
49 message::Table::Field::FieldType field_type= field.type();
50
51 switch (field_type)
52 {
53 case message::Table::Field::DOUBLE:
54 cout << " DOUBLE ";
55 break;
56 case message::Table::Field::VARCHAR:
57 cout << " VARCHAR(" << field.string_options().length() << ")";
58 break;
59 case message::Table::Field::BLOB:
60 cout << " BLOB "; /* FIXME: or text, depends on collation */
61 if(field.string_options().has_collation_id())
62 cout << "COLLATION=" << field.string_options().collation_id() << " ";
63 break;
64 case message::Table::Field::ENUM:
65 {
66 int x;
67
68 cout << " ENUM(";
69 for (x= 0; x < field.set_options().field_value_size() ; x++)
70 {
71 const string type= field.set_options().field_value(x);
72
73 if (x != 0)
74 cout << ",";
75 cout << "'" << type << "'";
76 }
77 cout << ") ";
78 break;
79 }
80 case message::Table::Field::INTEGER:
81 cout << " INT" ;
82 break;
83 case message::Table::Field::BIGINT:
84 cout << " BIGINT ";
85 break;
86 case message::Table::Field::DECIMAL:
87 cout << " DECIMAL(" << field.numeric_options().precision() << "," << field.numeric_options().scale() << ") ";
88 break;
89 case message::Table::Field::DATE:
90 cout << " DATE ";
91 break;
92 case message::Table::Field::TIMESTAMP:
93 cout << " TIMESTAMP ";
94 break;
95 case message::Table::Field::DATETIME:
96 cout << " DATETIME ";
97 break;
98 }
99
100 if (field.type() == message::Table::Field::INTEGER
101 || field.type() == message::Table::Field::BIGINT)
102 {
103 if (field.has_constraints()
104 && field.constraints().has_is_unsigned())
105 if (field.constraints().is_unsigned())
106 cout << " UNSIGNED";
107
108 if (field.has_numeric_options() &&
109 field.numeric_options().is_autoincrement())
110 cout << " AUTOINCREMENT ";
111 }
112
113 if (!( field.has_constraints()
114 && field.constraints().is_nullable()))
115 cout << " NOT NULL ";
116
117 if (field.type() == message::Table::Field::BLOB
118 || field.type() == message::Table::Field::VARCHAR)
119 {
120 if (field.string_options().has_collation())
121 cout << " COLLATE " << field.string_options().collation();
122 }
123
124 if (field.options().has_default_value())
125 cout << " DEFAULT `" << field.options().default_value() << "` " ;
126
127 if (field.options().has_default_bin_value())
128 {
129 string v= field.options().default_bin_value();
130 cout << " DEFAULT 0x";
131 for(unsigned int i=0; i< v.length(); i++)
132 {
133 printf("%.2x", *(v.c_str()+i));
134 }
135 }
136
137 if (field.type() == message::Table::Field::TIMESTAMP)
138 if (field.timestamp_options().has_auto_updates()
139 && field.timestamp_options().auto_updates())
140 cout << " ON UPDATE CURRENT_TIMESTAMP";
141
142 if (field.has_comment())
143 cout << " COMMENT `" << field.comment() << "` ";
144}
145
146static void print_engine(const message::Table::StorageEngine &engine)
147{
148 int32_t x;
149
150 cout << " ENGINE = " << engine.name() << endl;
151
152 for (x= 0; x < engine.option_size(); ++x) {
153 const message::Table::StorageEngine::EngineOption option= engine.option(x);
154 cout << "\t" << option.option_name() << " = "
155 << option.option_value() << endl;
156 }
157}
158
159static void print_index(const message::Table::Index &index)
160{
161
162 if (index.is_primary())
163 cout << " PRIMARY";
164 else if (index.is_unique())
165 cout << " UNIQUE";
166 cout << " KEY `" << index.name() << "` (";
167 {
168 int32_t x;
169
170 for (x= 0; x < index.index_part_size() ; x++)
171 {
172 const message::Table::Index::IndexPart part= index.index_part(x);
173
174 if (x != 0)
175 cout << ",";
176 cout << "`" << part.fieldnr() << "`"; /* FIXME */
177 if (part.has_compare_length())
178 cout << "(" << part.compare_length() << ")";
179 }
180 cout << ")";
181 }
182 cout << "\t";
183}
184
185static void print_table_options(const message::Table::TableOptions &options)
186{
187 if (options.has_comment())
188 cout << " COMMENT = '" << options.comment() << "' " << endl;
189
190 if (options.has_collation())
191 cout << " COLLATE = '" << options.collation() << "' " << endl;
192
193 if (options.has_auto_increment())
194 cout << " AUTOINCREMENT_OFFSET = " << options.auto_increment() << endl;
195
196 if (options.has_collation_id())
197 cout << "-- collation_id = " << options.collation_id() << endl;
198
199 if (options.has_row_type())
200 cout << " ROW_TYPE = " << options.row_type() << endl;
201
202 if (options.has_data_file_name())
203 cout << " DATA_FILE_NAME = '" << options.data_file_name() << "'" << endl;
204
205 if (options.has_index_file_name())
206 cout << " INDEX_FILE_NAME = '" << options.index_file_name() << "'" << endl;
207
208 if (options.has_max_rows())
209 cout << " MAX_ROWS = " << options.max_rows() << endl;
210
211 if (options.has_min_rows())
212 cout << " MIN_ROWS = " << options.min_rows() << endl;
213
214 if (options.has_auto_increment_value())
215 cout << " AUTO_INCREMENT = " << options.auto_increment_value() << endl;
216
217 if (options.has_avg_row_length())
218 cout << " AVG_ROW_LENGTH = " << options.avg_row_length() << endl;
219
220 if (options.has_key_block_size())
221 cout << " KEY_BLOCK_SIZE = " << options.key_block_size() << endl;
222
223 if (options.has_block_size())
224 cout << " BLOCK_SIZE = " << options.block_size() << endl;
225
226 if (options.has_comment())
227 cout << " COMMENT = '" << options.comment() << "'" << endl;
228
229 if (options.has_pack_keys())
230 cout << " PACK_KEYS = " << options.pack_keys() << endl;
231 if (options.has_pack_record())
232 cout << " PACK_RECORD = " << options.pack_record() << endl;
233 if (options.has_checksum())
234 cout << " CHECKSUM = " << options.checksum() << endl;
235 if (options.has_page_checksum())
236 cout << " PAGE_CHECKSUM = " << options.page_checksum() << endl;
237}
238
239
240static void print_table(const message::Table &table)
241{
242 int32_t x;
243
244 cout << "CREATE ";
245
246 if (table.type() == message::Table::TEMPORARY)
247 cout << "TEMPORARY ";
248
249 cout << "TABLE `" << table.name() << "` (" << endl;
250
251 for (x= 0; x < table.field_size() ; x++)
252 {
253 const message::Table::Field field = table.field(x);
254
255 if (x != 0)
256 cout << "," << endl;
257
258 print_field(field);
259 }
260
261 for (x= 0; x < table.indexes_size() ; x++)
262 {
263 const message::Table::Index index= table.indexes(x);
264
265 if (x != 0)
266 cout << "," << endl;;
267
268 print_index(index);
269
270 }
271 cout << endl;
272
273 cout << ") " << endl;
274
275 print_engine(table.engine());
276
277 if (table.has_options())
278 print_table_options(table.options());
279 /*
280 if (table->has_stats())
281 print_table_stats(&table->stats());
282 */
283}
284
285int main(int argc, char* argv[])45int main(int argc, char* argv[])
286{46{
287 GOOGLE_PROTOBUF_VERIFY_VERSION;47 GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -315,7 +75,10 @@
315 close(fd);75 close(fd);
316 }76 }
31777
318 print_table(table);78 string output;
79 (void) message::transformTableDefinitionToSql(table, output);
80
81 cout << output << endl;
31982
320 return 0;83 return 0;
321}84}
32285
=== modified file 'drizzled/message/transaction.proto'
--- drizzled/message/transaction.proto 2009-11-03 18:49:13 +0000
+++ drizzled/message/transaction.proto 2010-03-02 21:04:16 +0000
@@ -499,6 +499,7 @@
499message DropTableStatement499message DropTableStatement
500{500{
501 required TableMetadata table_metadata = 1; /* Minimal metadata about the table to be dropped */501 required TableMetadata table_metadata = 1; /* Minimal metadata about the table to be dropped */
502 optional bool if_exists_clause = 2; /* Did the user specify an IF EXISTS clause? */
502}503}
503504
504/*505/*
505506
=== modified file 'drizzled/replication_services.cc'
--- drizzled/replication_services.cc 2010-02-11 03:49:10 +0000
+++ drizzled/replication_services.cc 2010-03-02 21:04:16 +0000
@@ -508,7 +508,7 @@
508 * We add the "key field metadata" -- i.e. the fields which is508 * We add the "key field metadata" -- i.e. the fields which is
509 * the primary key for the table.509 * the primary key for the table.
510 */510 */
511 if (in_table->s->primary_key == current_field->field_index)511 if (in_table->s->fieldInPrimaryKey(current_field))
512 {512 {
513 field_metadata= header->add_key_field_metadata();513 field_metadata= header->add_key_field_metadata();
514 field_metadata->set_name(current_field->field_name);514 field_metadata->set_name(current_field->field_name);
@@ -602,7 +602,7 @@
602 * primary key field value. Replication only supports tables602 * primary key field value. Replication only supports tables
603 * with a primary key.603 * with a primary key.
604 */604 */
605 if (in_table->s->primary_key == current_field->field_index)605 if (in_table->s->fieldInPrimaryKey(current_field))
606 {606 {
607 /**607 /**
608 * To say the below is ugly is an understatement. But it works.608 * To say the below is ugly is an understatement. But it works.
@@ -682,7 +682,7 @@
682 * primary key field value. Replication only supports tables682 * primary key field value. Replication only supports tables
683 * with a primary key.683 * with a primary key.
684 */684 */
685 if (in_table->s->primary_key == current_field->field_index)685 if (in_table->s->fieldInPrimaryKey(current_field))
686 {686 {
687 field_metadata= header->add_key_field_metadata();687 field_metadata= header->add_key_field_metadata();
688 field_metadata->set_name(current_field->field_name);688 field_metadata->set_name(current_field->field_name);
@@ -715,7 +715,7 @@
715 * primary key field value. Replication only supports tables715 * primary key field value. Replication only supports tables
716 * with a primary key.716 * with a primary key.
717 */717 */
718 if (in_table->s->primary_key == current_field->field_index)718 if (in_table->s->fieldInPrimaryKey(current_field))
719 {719 {
720 string_value= current_field->val_str(string_value);720 string_value= current_field->val_str(string_value);
721 record->add_key_value(string_value->c_ptr(), string_value->length());721 record->add_key_value(string_value->c_ptr(), string_value->length());
@@ -727,6 +727,126 @@
727 }727 }
728}728}
729729
730void ReplicationServices::createTable(Session *in_session,
731 const message::Table &table)
732{
733 if (! is_active)
734 return;
735
736 message::Transaction *transaction= getActiveTransaction(in_session);
737 message::Statement *statement= transaction->add_statement();
738
739 initStatement(*statement, message::Statement::CREATE_TABLE, in_session);
740
741 /*
742 * Construct the specialized CreateTableStatement message and attach
743 * it to the generic Statement message
744 */
745 message::CreateTableStatement *create_table_statement= statement->mutable_create_table_statement();
746 message::Table *new_table_message= create_table_statement->mutable_table();
747 *new_table_message= table;
748
749 finalizeStatement(*statement, in_session);
750
751 finalizeTransaction(*transaction, in_session);
752
753 push(*transaction);
754
755 cleanupTransaction(transaction, in_session);
756
757}
758
759void ReplicationServices::createSchema(Session *in_session,
760 const message::Schema &schema)
761{
762 if (! is_active)
763 return;
764
765 message::Transaction *transaction= getActiveTransaction(in_session);
766 message::Statement *statement= transaction->add_statement();
767
768 initStatement(*statement, message::Statement::CREATE_SCHEMA, in_session);
769
770 /*
771 * Construct the specialized CreateSchemaStatement message and attach
772 * it to the generic Statement message
773 */
774 message::CreateSchemaStatement *create_schema_statement= statement->mutable_create_schema_statement();
775 message::Schema *new_schema_message= create_schema_statement->mutable_schema();
776 *new_schema_message= schema;
777
778 finalizeStatement(*statement, in_session);
779
780 finalizeTransaction(*transaction, in_session);
781
782 push(*transaction);
783
784 cleanupTransaction(transaction, in_session);
785
786}
787
788void ReplicationServices::dropSchema(Session *in_session, const string &schema_name)
789{
790 if (! is_active)
791 return;
792
793 message::Transaction *transaction= getActiveTransaction(in_session);
794 message::Statement *statement= transaction->add_statement();
795
796 initStatement(*statement, message::Statement::DROP_SCHEMA, in_session);
797
798 /*
799 * Construct the specialized DropSchemaStatement message and attach
800 * it to the generic Statement message
801 */
802 message::DropSchemaStatement *drop_schema_statement= statement->mutable_drop_schema_statement();
803
804 drop_schema_statement->set_schema_name(schema_name);
805
806 finalizeStatement(*statement, in_session);
807
808 finalizeTransaction(*transaction, in_session);
809
810 push(*transaction);
811
812 cleanupTransaction(transaction, in_session);
813}
814
815void ReplicationServices::dropTable(Session *in_session,
816 const string &schema_name,
817 const string &table_name,
818 bool if_exists)
819{
820 if (! is_active)
821 return;
822
823 message::Transaction *transaction= getActiveTransaction(in_session);
824 message::Statement *statement= transaction->add_statement();
825
826 initStatement(*statement, message::Statement::DROP_TABLE, in_session);
827
828 /*
829 * Construct the specialized DropTableStatement message and attach
830 * it to the generic Statement message
831 */
832 message::DropTableStatement *drop_table_statement= statement->mutable_drop_table_statement();
833
834 drop_table_statement->set_if_exists_clause(if_exists);
835
836 message::TableMetadata *table_metadata= drop_table_statement->mutable_table_metadata();
837
838 table_metadata->set_schema_name(schema_name);
839 table_metadata->set_table_name(table_name);
840
841 finalizeStatement(*statement, in_session);
842
843 finalizeTransaction(*transaction, in_session);
844
845 push(*transaction);
846
847 cleanupTransaction(transaction, in_session);
848}
849
730void ReplicationServices::truncateTable(Session *in_session, Table *in_table)850void ReplicationServices::truncateTable(Session *in_session, Table *in_table)
731{851{
732 if (! is_active)852 if (! is_active)
733853
=== modified file 'drizzled/replication_services.h'
--- drizzled/replication_services.h 2010-02-11 03:29:52 +0000
+++ drizzled/replication_services.h 2010-03-02 21:04:16 +0000
@@ -2,10 +2,11 @@
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *3 *
4 * Copyright (C) 2008-2009 Sun Microsystems4 * Copyright (C) 2008-2009 Sun Microsystems
5 * Copyright (c) 2009-2010 Jay Pipes <jaypipes@gmail.com>
5 *6 *
6 * Authors:7 * Authors:
7 *8 *
8 * Jay Pipes <joinfu@sun.com>9 * Jay Pipes <jaypipes@gmail.com>
9 *10 *
10 * This program is free software; you can redistribute it and/or modify11 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by12 * it under the terms of the GNU General Public License as published by
@@ -30,7 +31,6 @@
3031
31#include <vector>32#include <vector>
3233
33
34namespace drizzled34namespace drizzled
35{35{
3636
@@ -323,7 +323,48 @@
323 */323 */
324 void deleteRecord(Session *in_session, Table *in_table);324 void deleteRecord(Session *in_session, Table *in_table);
325 /**325 /**
326 * Creates a TruncateTable Statement GPB message and add it326 * Creates a CreateSchema Statement GPB message and adds it
327 * to the Session's active Transaction GPB message for pushing
328 * out to the replicator streams.
329 *
330 * @param[in] Pointer to the Session which issued the statement
331 * @param[in] message::Schema message describing new schema
332 */
333 void createSchema(Session *in_session, const message::Schema &schema);
334 /**
335 * Creates a DropSchema Statement GPB message and adds it
336 * to the Session's active Transaction GPB message for pushing
337 * out to the replicator streams.
338 *
339 * @param[in] Pointer to the Session which issued the statement
340 * @param[in] message::Schema message describing new schema
341 */
342 void dropSchema(Session *in_session, const std::string &schema_name);
343 /**
344 * Creates a CreateTable Statement GPB message and adds it
345 * to the Session's active Transaction GPB message for pushing
346 * out to the replicator streams.
347 *
348 * @param[in] Pointer to the Session which issued the statement
349 * @param[in] message::Table message describing new schema
350 */
351 void createTable(Session *in_session, const message::Table &table);
352 /**
353 * Creates a DropTable Statement GPB message and adds it
354 * to the Session's active Transaction GPB message for pushing
355 * out to the replicator streams.
356 *
357 * @param[in] Pointer to the Session which issued the statement
358 * @param[in] The schema of the table being dropped
359 * @param[in] The table name of the table being dropped
360 * @param[in] Did the user specify an IF EXISTS clause?
361 */
362 void dropTable(Session *in_session,
363 const std::string &schema_name,
364 const std::string &table_name,
365 bool if_exists);
366 /**
367 * Creates a TruncateTable Statement GPB message and adds it
327 * to the Session's active Transaction GPB message for pushing368 * to the Session's active Transaction GPB message for pushing
328 * out to the replicator streams.369 * out to the replicator streams.
329 *370 *
330371
=== modified file 'drizzled/sql_insert.cc'
--- drizzled/sql_insert.cc 2010-02-14 20:26:43 +0000
+++ drizzled/sql_insert.cc 2010-03-02 21:04:16 +0000
@@ -1615,32 +1615,17 @@
16151615
1616 DRIZZLE_LOCK *extra_lock= NULL;1616 DRIZZLE_LOCK *extra_lock= NULL;
1617 /*1617 /*
1618 For row-based replication, the CREATE-SELECT statement is written1618 For replication, the CREATE-SELECT statement is written
1619 in two pieces: the first one contain the CREATE TABLE statement1619 in two pieces: the first transaction messsage contains
1620 necessary to create the table and the second part contain the rows1620 the CREATE TABLE statement as a CreateTableStatement message
1621 that should go into the table.1621 necessary to create the table.
16221622
1623 For non-temporary tables, the start of the CREATE-SELECT1623 The second transaction message contains all the InsertStatement
1624 implicitly commits the previous transaction, and all events1624 and associated InsertRecords that should go into the table.
1625 forming the statement will be stored the transaction cache. At end
1626 of the statement, the entire statement is committed as a
1627 transaction, and all events are written to the binary log.
1628
1629 On the master, the table is locked for the duration of the
1630 statement, but since the CREATE part is replicated as a simple
1631 statement, there is no way to lock the table for accesses on the
1632 slave. Hence, we have to hold on to the CREATE part of the
1633 statement until the statement has finished.
1634 */1625 */
16351626
1636 unit= u;1627 unit= u;
16371628
1638 /*
1639 Start a statement transaction before the create if we are using
1640 row-based replication for the statement. If we are creating a
1641 temporary table, we need to start a statement transaction.
1642 */
1643
1644 if (!(table= create_table_from_items(session, create_info, create_table,1629 if (!(table= create_table_from_items(session, create_info, create_table,
1645 table_proto,1630 table_proto,
1646 alter_info, &values,1631 alter_info, &values,
16471632
=== modified file 'drizzled/sql_table.cc'
--- drizzled/sql_table.cc 2010-03-02 02:17:49 +0000
+++ drizzled/sql_table.cc 2010-03-02 21:04:16 +0000
@@ -54,6 +54,7 @@
54namespace drizzled54namespace drizzled
55{55{
5656
57extern plugin::StorageEngine *myisam_engine;
57extern pid_t current_pid;58extern pid_t current_pid;
5859
59bool is_primary_key(KEY *key_info)60bool is_primary_key(KEY *key_info)
@@ -249,7 +250,7 @@
249250
250 if ((error == ENOENT || error == HA_ERR_NO_SUCH_TABLE) && if_exists)251 if ((error == ENOENT || error == HA_ERR_NO_SUCH_TABLE) && if_exists)
251 {252 {
252 error= 0;253 error= 0;
253 session->clear_error();254 session->clear_error();
254 }255 }
255256
@@ -261,7 +262,10 @@
261 }262 }
262263
263 if (error == 0 || (if_exists && foreign_key_error == false))264 if (error == 0 || (if_exists && foreign_key_error == false))
264 write_bin_log_drop_table(session, if_exists, db, table->table_name);265 {
266 ReplicationServices &replication_services= ReplicationServices::singleton();
267 replication_services.dropTable(session, string(db), string(table->table_name), if_exists);
268 }
265269
266 if (error)270 if (error)
267 {271 {
@@ -757,9 +761,11 @@
757 }761 }
758 }762 }
759 }763 }
760 /* Don't pack rows in old tables if the user has requested this */764
761 if ((sql_field->flags & BLOB_FLAG) ||765 /** @todo Get rid of this MyISAM-specific crap. */
762 (sql_field->sql_type == DRIZZLE_TYPE_VARCHAR && create_info->row_type != ROW_TYPE_FIXED))766 if (create_info->db_type == myisam_engine &&
767 ((sql_field->flags & BLOB_FLAG) ||
768 (sql_field->sql_type == DRIZZLE_TYPE_VARCHAR && create_info->row_type != ROW_TYPE_FIXED)))
763 (*db_options)|= HA_OPTION_PACK_RECORD;769 (*db_options)|= HA_OPTION_PACK_RECORD;
764 it2.rewind();770 it2.rewind();
765 }771 }
@@ -1451,15 +1457,11 @@
1451 }1457 }
1452 }1458 }
14531459
1454 /*
1455 Don't write statement if:
1456 - It is an internal temporary table,
1457 - Row-based logging is used and it we are creating a temporary table, or
1458 - The binary log is not open.
1459 Otherwise, the statement shall be binlogged.
1460 */
1461 if (not internal_tmp_table && not lex_identified_temp_table)1460 if (not internal_tmp_table && not lex_identified_temp_table)
1462 write_bin_log(session, session->query.c_str());1461 {
1462 ReplicationServices &replication_services= ReplicationServices::singleton();
1463 replication_services.createTable(session, *table_proto);
1464 }
1463 error= false;1465 error= false;
1464unlock_and_end:1466unlock_and_end:
1465 pthread_mutex_unlock(&LOCK_open);1467 pthread_mutex_unlock(&LOCK_open);
14661468
=== modified file 'drizzled/table_proto_write.cc'
--- drizzled/table_proto_write.cc 2010-02-24 00:18:38 +0000
+++ drizzled/table_proto_write.cc 2010-03-02 21:04:16 +0000
@@ -309,7 +309,7 @@
309 switch(create_info->row_type)309 switch(create_info->row_type)
310 {310 {
311 case ROW_TYPE_DEFAULT:311 case ROW_TYPE_DEFAULT:
312 table_options->set_row_type(message::Table::TableOptions::ROW_TYPE_DEFAULT);312 /* No use setting a default row type... just adds redundant info to message */
313 break;313 break;
314 case ROW_TYPE_FIXED:314 case ROW_TYPE_FIXED:
315 table_options->set_row_type(message::Table::TableOptions::ROW_TYPE_FIXED);315 table_options->set_row_type(message::Table::TableOptions::ROW_TYPE_FIXED);
@@ -333,8 +333,8 @@
333 abort();333 abort();
334 }334 }
335335
336 table_options->set_pack_record(create_info->table_options336 if (create_info->table_options & HA_OPTION_PACK_RECORD)
337 & HA_OPTION_PACK_RECORD);337 table_options->set_pack_record(true);
338338
339 if (table_options->has_comment())339 if (table_options->has_comment())
340 {340 {
@@ -447,7 +447,10 @@
447447
448 idx->set_comment(key_info[i].comment.str);448 idx->set_comment(key_info[i].comment.str);
449 }449 }
450 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))450 if (key_info[i].flags &
451 ~(HA_NOSAME | HA_PACK_KEY | HA_USES_BLOCK_SIZE |
452 HA_BINARY_PACK_KEY | HA_VAR_LENGTH_PART | HA_NULL_PART_KEY |
453 HA_KEY_HAS_PART_KEY_SEG | HA_GENERATED_KEY | HA_USES_COMMENT))
451 abort(); // Invalid (unknown) index flag.454 abort(); // Invalid (unknown) index flag.
452455
453 for(unsigned int j=0; j< key_info[i].key_parts; j++)456 for(unsigned int j=0; j< key_info[i].key_parts; j++)
454457
=== modified file 'drizzled/table_share.cc'
--- drizzled/table_share.cc 2010-02-04 08:14:46 +0000
+++ drizzled/table_share.cc 2010-03-02 21:04:16 +0000
@@ -273,4 +273,31 @@
273 }273 }
274}274}
275275
276/**
277 * @todo
278 *
279 * Precache this stuff....
280 */
281bool TableShare::fieldInPrimaryKey(Field *in_field) const
282{
283 assert(table_proto != NULL);
284
285 size_t num_indexes= table_proto->indexes_size();
286
287 for (size_t x= 0; x < num_indexes; ++x)
288 {
289 const message::Table::Index &index= table_proto->indexes(x);
290 if (index.is_primary())
291 {
292 size_t num_parts= index.index_part_size();
293 for (size_t y= 0; y < num_parts; ++y)
294 {
295 if (index.index_part(y).fieldnr() == in_field->field_index)
296 return true;
297 }
298 }
299 }
300 return false;
301}
302
276} /* namespace drizzled */303} /* namespace drizzled */
277304
=== modified file 'drizzled/table_share.h'
--- drizzled/table_share.h 2010-02-23 01:14:53 +0000
+++ drizzled/table_share.h 2010-03-02 21:04:16 +0000
@@ -260,6 +260,12 @@
260 max_rows= arg;260 max_rows= arg;
261 }261 }
262262
263 /**
264 * Returns true if the supplied Field object
265 * is part of the table's primary key.
266 */
267 bool fieldInPrimaryKey(Field *field) const;
268
263 plugin::StorageEngine *storage_engine; /* storage engine plugin */269 plugin::StorageEngine *storage_engine; /* storage engine plugin */
264 inline plugin::StorageEngine *db_type() const /* table_type for handler */270 inline plugin::StorageEngine *db_type() const /* table_type for handler */
265 {271 {
266272
=== modified file 'plugin/transaction_log/tests/r/alter.result'
--- plugin/transaction_log/tests/r/alter.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/alter.result 2010-03-02 21:04:16 +0000
@@ -10,10 +10,10 @@
10ALTER TABLE t1 ADD INDEX ix_padding (padding(20));10ALTER TABLE t1 ADD INDEX ix_padding (padding(20));
11DROP TABLE t1;11DROP TABLE t1;
12START TRANSACTION;12START TRANSACTION;
13DROP TABLE IF EXISTS `t1`;13DROP TABLE IF EXISTS `test`.`t1`;
14COMMIT;14COMMIT;
15START TRANSACTION;15START TRANSACTION;
16CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );16CREATE 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;
17COMMIT;17COMMIT;
18START TRANSACTION;18START TRANSACTION;
19INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');19INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -28,6 +28,6 @@
28ALTER TABLE t1 ADD INDEX ix_padding (padding(20));28ALTER TABLE t1 ADD INDEX ix_padding (padding(20));
29COMMIT;29COMMIT;
30START TRANSACTION;30START TRANSACTION;
31DROP TABLE `t1`;31DROP TABLE `test`.`t1`;
32COMMIT;32COMMIT;
33SET GLOBAL transaction_log_truncate_debug= true;33SET GLOBAL transaction_log_truncate_debug= true;
3434
=== modified file 'plugin/transaction_log/tests/r/auto_commit.result'
--- plugin/transaction_log/tests/r/auto_commit.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/auto_commit.result 2010-03-02 21:04:16 +0000
@@ -16,28 +16,28 @@
16INSERT INTO t1 VALUES (2, "I hate testing.");16INSERT INTO t1 VALUES (2, "I hate testing.");
17DROP TABLE t1;17DROP TABLE t1;
18START TRANSACTION;18START TRANSACTION;
19DROP TABLE IF EXISTS `t1`;19DROP TABLE IF EXISTS `test`.`t1`;
20COMMIT;20COMMIT;
21START TRANSACTION;21START TRANSACTION;
22CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );22CREATE 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;
23COMMIT;23COMMIT;
24START TRANSACTION;24START TRANSACTION;
25INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');25INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
26INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');26INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
27COMMIT;27COMMIT;
28START TRANSACTION;28START TRANSACTION;
29DROP TABLE `t1`;29DROP TABLE `test`.`t1`;
30COMMIT;30COMMIT;
31START TRANSACTION;31START TRANSACTION;
32CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );32CREATE 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;
33COMMIT;33COMMIT;
34START TRANSACTION;34START TRANSACTION;
35INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');35INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
36COMMIT;36COMMIT;
37START TRANSACTION;37START TRANSACTION;
38INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');38INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
39COMMIT;39COMMIT;
40START TRANSACTION;40START TRANSACTION;
41DROP TABLE `t1`;41DROP TABLE `test`.`t1`;
42COMMIT;42COMMIT;
43SET GLOBAL transaction_log_truncate_debug= true;43SET GLOBAL transaction_log_truncate_debug= true;
4444
=== modified file 'plugin/transaction_log/tests/r/blob.result'
--- plugin/transaction_log/tests/r/blob.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/blob.result 2010-03-02 21:04:16 +0000
@@ -10,10 +10,10 @@
10DELETE FROM t1 WHERE padding = 'test\0you';10DELETE FROM t1 WHERE padding = 'test\0you';
11DROP TABLE t1;11DROP TABLE t1;
12START TRANSACTION;12START TRANSACTION;
13DROP TABLE IF EXISTS `t1`;13DROP TABLE IF EXISTS `test`.`t1`;
14COMMIT;14COMMIT;
15START TRANSACTION;15START TRANSACTION;
16CREATE TABLE t1 ( id INT NOT NULL , padding BLOB NOT NULL , PRIMARY KEY (id) );16CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` BLOB NOT NULL COLLATE binary, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
17COMMIT;17COMMIT;
18START TRANSACTION;18START TRANSACTION;
19INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'test\0me');19INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'test\0me');
@@ -29,6 +29,6 @@
29DELETE FROM `test`.`t1` WHERE `id`=2;29DELETE FROM `test`.`t1` WHERE `id`=2;
30COMMIT;30COMMIT;
31START TRANSACTION;31START TRANSACTION;
32DROP TABLE `t1`;32DROP TABLE `test`.`t1`;
33COMMIT;33COMMIT;
34SET GLOBAL transaction_log_truncate_debug= true;34SET GLOBAL transaction_log_truncate_debug= true;
3535
=== added file 'plugin/transaction_log/tests/r/create_schema.result'
--- plugin/transaction_log/tests/r/create_schema.result 1970-01-01 00:00:00 +0000
+++ plugin/transaction_log/tests/r/create_schema.result 2010-03-02 21:04:16 +0000
@@ -0,0 +1,13 @@
1DROP SCHEMA IF EXISTS my_new_schema;
2CREATE SCHEMA my_new_warnings;
3DROP SCHEMA my_new_warnings;
4START TRANSACTION;
5DROP SCHEMA IF EXISTS my_new_schema;
6COMMIT;
7START TRANSACTION;
8CREATE SCHEMA `my_new_warnings` COLLATE utf8_general_ci;
9COMMIT;
10START TRANSACTION;
11DROP SCHEMA my_new_warnings;
12COMMIT;
13SET GLOBAL transaction_log_truncate_debug= true;
014
=== modified file 'plugin/transaction_log/tests/r/create_select.result'
--- plugin/transaction_log/tests/r/create_select.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/create_select.result 2010-03-02 21:04:16 +0000
@@ -12,13 +12,13 @@
12) SELECT * FROM t1;12) SELECT * FROM t1;
13DROP TABLE t1, t2;13DROP TABLE t1, t2;
14START TRANSACTION;14START TRANSACTION;
15DROP TABLE IF EXISTS `t1`;15DROP TABLE IF EXISTS `test`.`t1`;
16COMMIT;16COMMIT;
17START TRANSACTION;17START TRANSACTION;
18DROP TABLE IF EXISTS `t2`;18DROP TABLE IF EXISTS `test`.`t2`;
19COMMIT;19COMMIT;
20START TRANSACTION;20START TRANSACTION;
21CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );21CREATE 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;
22COMMIT;22COMMIT;
23START TRANSACTION;23START TRANSACTION;
24INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');24INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -27,12 +27,16 @@
27INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');27INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
28COMMIT;28COMMIT;
29START TRANSACTION;29START TRANSACTION;
30CREATE TABLE t2 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL ) SELECT * FROM t1;30CREATE 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;
31COMMIT;31COMMIT;
32START TRANSACTION;32START TRANSACTION;
33DROP TABLE `t1`;33INSERT INTO `test`.`t2` (`id`,`padding`) VALUES (1,'I love testing.');
34COMMIT;34INSERT INTO `test`.`t2` (`id`,`padding`) VALUES (2,'I hate testing.');
35START TRANSACTION;35COMMIT;
36DROP TABLE `t2`;36START TRANSACTION;
37DROP TABLE `test`.`t1`;
38COMMIT;
39START TRANSACTION;
40DROP TABLE `test`.`t2`;
37COMMIT;41COMMIT;
38SET GLOBAL transaction_log_truncate_debug= true;42SET GLOBAL transaction_log_truncate_debug= true;
3943
=== added file 'plugin/transaction_log/tests/r/create_table.result'
--- plugin/transaction_log/tests/r/create_table.result 1970-01-01 00:00:00 +0000
+++ plugin/transaction_log/tests/r/create_table.result 2010-03-02 21:04:16 +0000
@@ -0,0 +1,54 @@
1DROP TABLE IF EXISTS t1;
2CREATE TABLE t1 (
3autoinc_int_field INT NOT NULL AUTO_INCREMENT
4, null_int_field INT NULL
5, not_null_bigint_field BIGINT NOT NULL
6, null_bigint_field BIGINT NULL
7, not_null_int_field INT NOT NULL
8, null_varchar_field VARCHAR(100) NULL
9, not_null_varchar_field VARCHAR(100) NOT NULL
10, null_enum_field ENUM ('val1', 'val2') NULL
11, not_null_enum_field ENUM ('val1', 'val2') NOT NULL
12, null_date_field DATE NULL
13, not_null_date_field DATE NOT NULL
14, null_datetime_field DATETIME NULL
15, not_null_datetime_field DATETIME NOT NULL
16, null_blob_field BLOB NULL
17, not_null_blob_field BLOB NOT NULL
18, null_text_field TEXT NULL
19, not_null_text_field TEXT NOT NULL
20, null_timestamp_field TIMESTAMP NULL
21, not_null_timestamp_field TIMESTAMP NOT NULL
22, null_double_field DOUBLE NULL
23, not_null_double_field DOUBLE NOT NULL
24, null_decimal_field DECIMAL(10,2) NULL
25, not_null_decimal_field DECIMAL(10,2) NOT NULL
26, PRIMARY KEY (autoinc_int_field)
27);
28DROP TABLE t1;
29CREATE TABLE t1 (
30id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
31, key1 VARCHAR(10) NOT NULL
32, key2 DOUBLE NOT NULL
33, key3 BLOB NOT NULL
34, UNIQUE KEY (key1)
35, KEY named_key (key2)
36, KEY partial_key (key3(30))
37);
38DROP TABLE t1;
39START TRANSACTION;
40DROP TABLE IF EXISTS `test`.`t1`;
41COMMIT;
42START TRANSACTION;
43CREATE 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;
44COMMIT;
45START TRANSACTION;
46DROP TABLE `test`.`t1`;
47COMMIT;
48START TRANSACTION;
49CREATE 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;
50COMMIT;
51START TRANSACTION;
52DROP TABLE `test`.`t1`;
53COMMIT;
54SET GLOBAL transaction_log_truncate_debug= true;
055
=== modified file 'plugin/transaction_log/tests/r/database.result'
--- plugin/transaction_log/tests/r/database.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/database.result 2010-03-02 21:04:16 +0000
@@ -1,7 +1,7 @@
1CREATE DATABASE test1;1CREATE DATABASE test1;
2DROP DATABASE test1;2DROP DATABASE test1;
3START TRANSACTION;3START TRANSACTION;
4CREATE DATABASE test1;4CREATE SCHEMA `test1` COLLATE utf8_general_ci;
5COMMIT;5COMMIT;
6START TRANSACTION;6START TRANSACTION;
7DROP DATABASE test1;7DROP DATABASE test1;
88
=== modified file 'plugin/transaction_log/tests/r/delete.result'
--- plugin/transaction_log/tests/r/delete.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/delete.result 2010-03-02 21:04:16 +0000
@@ -37,10 +37,10 @@
37DROP TABLE t1;37DROP TABLE t1;
38End Test of LP Bug #49610138End Test of LP Bug #496101
39START TRANSACTION;39START TRANSACTION;
40DROP TABLE IF EXISTS `t1`;40DROP TABLE IF EXISTS `test`.`t1`;
41COMMIT;41COMMIT;
42START TRANSACTION;42START TRANSACTION;
43CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );43CREATE 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;
44COMMIT;44COMMIT;
45START TRANSACTION;45START TRANSACTION;
46INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');46INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -52,10 +52,10 @@
52DELETE FROM `test`.`t1` WHERE `id`=1;52DELETE FROM `test`.`t1` WHERE `id`=1;
53COMMIT;53COMMIT;
54START TRANSACTION;54START TRANSACTION;
55DROP TABLE `t1`;55DROP TABLE `test`.`t1`;
56COMMIT;56COMMIT;
57START TRANSACTION;57START TRANSACTION;
58CREATE TABLE t1 ( id INT NOT NULL , other INT NOT NULL , PRIMARY KEY (id) );58CREATE TABLE `t1` ( `id` INT NOT NULL, `other` INT NOT NULL, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
59COMMIT;59COMMIT;
60START TRANSACTION;60START TRANSACTION;
61INSERT INTO `test`.`t1` (`id`,`other`) VALUES (1,1);61INSERT INTO `test`.`t1` (`id`,`other`) VALUES (1,1);
@@ -92,10 +92,10 @@
92DELETE FROM `test`.`t1` WHERE `id`=8;92DELETE FROM `test`.`t1` WHERE `id`=8;
93COMMIT;93COMMIT;
94START TRANSACTION;94START TRANSACTION;
95DROP TABLE `t1`;95DROP TABLE `test`.`t1`;
96COMMIT;96COMMIT;
97START TRANSACTION;97START TRANSACTION;
98CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );98CREATE 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;
99COMMIT;99COMMIT;
100START TRANSACTION;100START TRANSACTION;
101INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');101INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -103,6 +103,6 @@
103DELETE FROM `test`.`t1` WHERE `id`=1;103DELETE FROM `test`.`t1` WHERE `id`=1;
104COMMIT;104COMMIT;
105START TRANSACTION;105START TRANSACTION;
106DROP TABLE `t1`;106DROP TABLE `test`.`t1`;
107COMMIT;107COMMIT;
108SET GLOBAL transaction_log_truncate_debug= true;108SET GLOBAL transaction_log_truncate_debug= true;
109109
=== modified file 'plugin/transaction_log/tests/r/filtered_replicator.result'
--- plugin/transaction_log/tests/r/filtered_replicator.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/filtered_replicator.result 2010-03-02 21:04:16 +0000
@@ -36,8 +36,9 @@
36ALTER TABLE t1 ADD dummy INT;36ALTER TABLE t1 ADD dummy INT;
37ALTER TABLE t1 ADD INDEX ix_padding (padding(20));37ALTER TABLE t1 ADD INDEX ix_padding (padding(20));
38DROP TABLE t1;38DROP TABLE t1;
39CREATE DATABASE test1;39DROP SCHEMA IF EXISTS my_new_schema;
40DROP DATABASE test1;40CREATE SCHEMA my_new_warnings;
41DROP SCHEMA my_new_warnings;
41DROP TABLE IF EXISTS t1, t2;42DROP TABLE IF EXISTS t1, t2;
42CREATE TABLE t1 (43CREATE TABLE t1 (
43id INT NOT NULL44id INT NOT NULL
@@ -121,47 +122,44 @@
121UPDATE t1 SET id = 4 WHERE id = 2;122UPDATE t1 SET id = 4 WHERE id = 2;
122DROP TABLE t1;123DROP TABLE t1;
123START TRANSACTION;124START TRANSACTION;
124DROP TABLE IF EXISTS `t1`;125DROP TABLE IF EXISTS `test`.`t1`;
125COMMIT;126COMMIT;
126START TRANSACTION;127START TRANSACTION;
127CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );128CREATE 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;
128COMMIT;129COMMIT;
129START TRANSACTION;130START TRANSACTION;
130INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');131INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
131COMMIT;132COMMIT;
132START TRANSACTION;133START TRANSACTION;
133INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');134INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
134COMMIT;135COMMIT;
135START TRANSACTION;136START TRANSACTION;
136DROP TABLE IF EXISTS `t1`;137DROP TABLE IF EXISTS `test`.`t1`;
137COMMIT;138COMMIT;
138START TRANSACTION;139START TRANSACTION;
139CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );140CREATE 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;
140COMMIT;141COMMIT;
141START TRANSACTION;142START TRANSACTION;
142INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');143INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
143INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');144INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
144COMMIT;145COMMIT;
145START TRANSACTION;146START TRANSACTION;
146DROP TABLE IF EXISTS `t1`;147DROP TABLE IF EXISTS `test`.`t1`;
147COMMIT;148COMMIT;
148START TRANSACTION;149START TRANSACTION;
149DROP TABLE IF EXISTS `t2`;150CREATE 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;
150COMMIT;151COMMIT;
151START TRANSACTION;152START TRANSACTION;
152CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );153INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
153COMMIT;154COMMIT;
154START TRANSACTION;155START TRANSACTION;
155INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');156INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
156COMMIT;157COMMIT;
157START TRANSACTION;158START TRANSACTION;
158INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');159DROP TABLE IF EXISTS `test`.`t1`;
159COMMIT;160COMMIT;
160START TRANSACTION;161START TRANSACTION;
161DROP TABLE IF EXISTS `t1`;162CREATE 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;
162COMMIT;
163START TRANSACTION;
164CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );
165COMMIT;163COMMIT;
166START TRANSACTION;164START TRANSACTION;
167INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');165INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -176,31 +174,31 @@
176ALTER TABLE t1 ADD INDEX ix_padding (padding(20));174ALTER TABLE t1 ADD INDEX ix_padding (padding(20));
177COMMIT;175COMMIT;
178START TRANSACTION;176START TRANSACTION;
179DROP TABLE `t1`;177DROP TABLE `test`.`t1`;
180COMMIT;178COMMIT;
181START TRANSACTION;179START TRANSACTION;
182CREATE DATABASE test1;180DROP SCHEMA `my_new_schema`;
183COMMIT;181COMMIT;
184START TRANSACTION;182START TRANSACTION;
185DROP DATABASE test1;183CREATE SCHEMA `my_new_warnings` COLLATE utf8_general_ci;
186COMMIT;184COMMIT;
187START TRANSACTION;185START TRANSACTION;
188DROP TABLE IF EXISTS `t1`;186DROP SCHEMA `my_new_warnings`;
189COMMIT;187COMMIT;
190START TRANSACTION;188START TRANSACTION;
191DROP TABLE IF EXISTS `t2`;189DROP TABLE IF EXISTS `test`.`t1`;
192COMMIT;190COMMIT;
193START TRANSACTION;191START TRANSACTION;
194CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );192CREATE 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;
195COMMIT;193COMMIT;
196START TRANSACTION;194START TRANSACTION;
197RENAME TABLE t1 TO t2;195RENAME TABLE t1 TO t2;
198COMMIT;196COMMIT;
199START TRANSACTION;197START TRANSACTION;
200DROP TABLE IF EXISTS `t1`;198DROP TABLE IF EXISTS `test`.`t1`;
201COMMIT;199COMMIT;
202START TRANSACTION;200START TRANSACTION;
203CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );201CREATE 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;
204COMMIT;202COMMIT;
205START TRANSACTION;203START TRANSACTION;
206INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');204INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -212,10 +210,10 @@
212DELETE FROM `test`.`t1` WHERE `id`=1;210DELETE FROM `test`.`t1` WHERE `id`=1;
213COMMIT;211COMMIT;
214START TRANSACTION;212START TRANSACTION;
215DROP TABLE `t1`;213DROP TABLE `test`.`t1`;
216COMMIT;214COMMIT;
217START TRANSACTION;215START TRANSACTION;
218CREATE TABLE t1 ( id INT NOT NULL , other INT NOT NULL , PRIMARY KEY (id) );216CREATE TABLE `t1` ( `id` INT NOT NULL, `other` INT NOT NULL, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
219COMMIT;217COMMIT;
220START TRANSACTION;218START TRANSACTION;
221INSERT INTO `test`.`t1` (`id`,`other`) VALUES (1,1);219INSERT INTO `test`.`t1` (`id`,`other`) VALUES (1,1);
@@ -252,10 +250,10 @@
252DELETE FROM `test`.`t1` WHERE `id`=8;250DELETE FROM `test`.`t1` WHERE `id`=8;
253COMMIT;251COMMIT;
254START TRANSACTION;252START TRANSACTION;
255DROP TABLE `t1`;253DROP TABLE `test`.`t1`;
256COMMIT;254COMMIT;
257START TRANSACTION;255START TRANSACTION;
258CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );256CREATE 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;
259COMMIT;257COMMIT;
260START TRANSACTION;258START TRANSACTION;
261INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');259INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -263,13 +261,13 @@
263DELETE FROM `test`.`t1` WHERE `id`=1;261DELETE FROM `test`.`t1` WHERE `id`=1;
264COMMIT;262COMMIT;
265START TRANSACTION;263START TRANSACTION;
266DROP TABLE `t1`;264DROP TABLE `test`.`t1`;
267COMMIT;265COMMIT;
268START TRANSACTION;266START TRANSACTION;
269DROP TABLE IF EXISTS `t1`;267DROP TABLE IF EXISTS `test`.`t1`;
270COMMIT;268COMMIT;
271START TRANSACTION;269START TRANSACTION;
272CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );270CREATE 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;
273COMMIT;271COMMIT;
274START TRANSACTION;272START TRANSACTION;
275INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');273INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -285,10 +283,10 @@
285UPDATE `test`.`t1` SET `padding`='AAA' WHERE `id`=2;283UPDATE `test`.`t1` SET `padding`='AAA' WHERE `id`=2;
286COMMIT;284COMMIT;
287START TRANSACTION;285START TRANSACTION;
288DROP TABLE `t1`;286DROP TABLE `test`.`t1`;
289COMMIT;287COMMIT;
290START TRANSACTION;288START TRANSACTION;
291CREATE TABLE t1 ( id int AUTO_INCREMENT NOT NULL PRIMARY KEY , name varchar(1024) , alias varchar(1024) );289CREATE 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;
292COMMIT;290COMMIT;
293START TRANSACTION;291START TRANSACTION;
294INSERT INTO `test`.`t1` (`id`,`name`,`alias`) VALUES (1,'jeff lebowski','dude');292INSERT INTO `test`.`t1` (`id`,`name`,`alias`) VALUES (1,'jeff lebowski','dude');
@@ -297,10 +295,10 @@
297UPDATE `test`.`t1` SET `alias`='the dude' WHERE `id`=1;295UPDATE `test`.`t1` SET `alias`='the dude' WHERE `id`=1;
298COMMIT;296COMMIT;
299START TRANSACTION;297START TRANSACTION;
300DROP TABLE `t1`;298DROP TABLE `test`.`t1`;
301COMMIT;299COMMIT;
302START TRANSACTION;300START TRANSACTION;
303CREATE TABLE t1 ( id INT NOT NULL , counter INT NOT NULL , PRIMARY KEY (id) );301CREATE TABLE `t1` ( `id` INT NOT NULL, `counter` INT NOT NULL, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
304COMMIT;302COMMIT;
305START TRANSACTION;303START TRANSACTION;
306INSERT INTO `test`.`t1` (`id`,`counter`) VALUES (1,1);304INSERT INTO `test`.`t1` (`id`,`counter`) VALUES (1,1);
@@ -315,10 +313,10 @@
315UPDATE `test`.`t1` SET `counter`=4 WHERE `id`=3;313UPDATE `test`.`t1` SET `counter`=4 WHERE `id`=3;
316COMMIT;314COMMIT;
317START TRANSACTION;315START TRANSACTION;
318DROP TABLE `t1`;316DROP TABLE `test`.`t1`;
319COMMIT;317COMMIT;
320START TRANSACTION;318START TRANSACTION;
321CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );319CREATE 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;
322COMMIT;320COMMIT;
323START TRANSACTION;321START TRANSACTION;
324INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');322INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -330,6 +328,6 @@
330UPDATE `test`.`t1` SET `id`=4 WHERE `id`=2;328UPDATE `test`.`t1` SET `id`=4 WHERE `id`=2;
331COMMIT;329COMMIT;
332START TRANSACTION;330START TRANSACTION;
333DROP TABLE `t1`;331DROP TABLE `test`.`t1`;
334COMMIT;332COMMIT;
335SET GLOBAL transaction_log_truncate_debug= true;333SET GLOBAL transaction_log_truncate_debug= true;
336334
=== modified file 'plugin/transaction_log/tests/r/insert.result'
--- plugin/transaction_log/tests/r/insert.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/insert.result 2010-03-02 21:04:16 +0000
@@ -6,10 +6,10 @@
6INSERT INTO t1 VALUES (1, "I love testing.");6INSERT INTO t1 VALUES (1, "I love testing.");
7INSERT INTO t1 VALUES (2, "I hate testing.");7INSERT INTO t1 VALUES (2, "I hate testing.");
8START TRANSACTION;8START TRANSACTION;
9DROP TABLE IF EXISTS `t1`;9DROP TABLE IF EXISTS `test`.`t1`;
10COMMIT;10COMMIT;
11START TRANSACTION;11START TRANSACTION;
12CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );12CREATE 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;
13COMMIT;13COMMIT;
14START TRANSACTION;14START TRANSACTION;
15INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');15INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
1616
=== modified file 'plugin/transaction_log/tests/r/insert_multi.result'
--- plugin/transaction_log/tests/r/insert_multi.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/insert_multi.result 2010-03-02 21:04:16 +0000
@@ -5,10 +5,10 @@
5);5);
6INSERT INTO t1 VALUES (1, "I love testing."), (2, "I hate testing.");6INSERT INTO t1 VALUES (1, "I love testing."), (2, "I hate testing.");
7START TRANSACTION;7START TRANSACTION;
8DROP TABLE IF EXISTS `t1`;8DROP TABLE IF EXISTS `test`.`t1`;
9COMMIT;9COMMIT;
10START TRANSACTION;10START TRANSACTION;
11CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );11CREATE 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;
12COMMIT;12COMMIT;
13START TRANSACTION;13START TRANSACTION;
14INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');14INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
1515
=== modified file 'plugin/transaction_log/tests/r/insert_on_duplicate_update.result'
--- plugin/transaction_log/tests/r/insert_on_duplicate_update.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/insert_on_duplicate_update.result 2010-03-02 21:04:16 +0000
@@ -9,10 +9,10 @@
9ON DUPLICATE KEY UPDATE padding="I love testing";9ON DUPLICATE KEY UPDATE padding="I love testing";
10DROP TABLE t1;10DROP TABLE t1;
11START TRANSACTION;11START TRANSACTION;
12DROP TABLE IF EXISTS `t1`;12DROP TABLE IF EXISTS `test`.`t1`;
13COMMIT;13COMMIT;
14START TRANSACTION;14START TRANSACTION;
15CREATE TABLE t1 ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , padding VARCHAR(200) NOT NULL );15CREATE 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;
16COMMIT;16COMMIT;
17START TRANSACTION;17START TRANSACTION;
18INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');18INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -24,6 +24,6 @@
24UPDATE `test`.`t1` SET `padding`='I love testing' WHERE `id`=2;24UPDATE `test`.`t1` SET `padding`='I love testing' WHERE `id`=2;
25COMMIT;25COMMIT;
26START TRANSACTION;26START TRANSACTION;
27DROP TABLE `t1`;27DROP TABLE `test`.`t1`;
28COMMIT;28COMMIT;
29SET GLOBAL transaction_log_truncate_debug= true;29SET GLOBAL transaction_log_truncate_debug= true;
3030
=== modified file 'plugin/transaction_log/tests/r/insert_select.result'
--- plugin/transaction_log/tests/r/insert_select.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/insert_select.result 2010-03-02 21:04:16 +0000
@@ -12,13 +12,13 @@
12);12);
13INSERT INTO t2 SELECT * FROM t1;13INSERT INTO t2 SELECT * FROM t1;
14START TRANSACTION;14START TRANSACTION;
15DROP TABLE IF EXISTS `t1`;15DROP TABLE IF EXISTS `test`.`t1`;
16COMMIT;16COMMIT;
17START TRANSACTION;17START TRANSACTION;
18DROP TABLE IF EXISTS `t2`;18DROP TABLE IF EXISTS `test`.`t2`;
19COMMIT;19COMMIT;
20START TRANSACTION;20START TRANSACTION;
21CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );21CREATE 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;
22COMMIT;22COMMIT;
23START TRANSACTION;23START TRANSACTION;
24INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');24INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -27,7 +27,7 @@
27INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');27INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I hate testing.');
28COMMIT;28COMMIT;
29START TRANSACTION;29START TRANSACTION;
30CREATE TABLE t2 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );30CREATE 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;
31COMMIT;31COMMIT;
32START TRANSACTION;32START TRANSACTION;
33INSERT INTO `test`.`t2` (`id`,`padding`) VALUES (1,'I love testing.');33INSERT INTO `test`.`t2` (`id`,`padding`) VALUES (1,'I love testing.');
3434
=== added file 'plugin/transaction_log/tests/r/multi_column_primary_key.result'
--- plugin/transaction_log/tests/r/multi_column_primary_key.result 1970-01-01 00:00:00 +0000
+++ plugin/transaction_log/tests/r/multi_column_primary_key.result 2010-03-02 21:04:16 +0000
@@ -0,0 +1,55 @@
1DROP TABLE IF EXISTS t1;
2CREATE TABLE t1 (
3k1 INT NOT NULL
4, k2 INT NOT NULL
5, padding VARCHAR(200) NOT NULL
6, PRIMARY KEY (k1, k2)
7);
8INSERT INTO t1 VALUES (1, 1, "I love testing.");
9INSERT INTO t1 VALUES (2, 2, "I hate testing.");
10INSERT INTO t1 VALUES (2, 3, "I hate and love testing.");
11INSERT INTO t1 VALUES (3, 3, "I adore testing.");
12UPDATE t1 SET padding= "XXX" WHERE k1= 1 AND k2= 1;
13UPDATE t1 SET padding= "YYY" WHERE k1= 2;
14UPDATE t1 SET padding= "ZZZ" WHERE k2= 3;
15UPDATE t1 SET padding= "AAA";
16DROP TABLE t1;
17START TRANSACTION;
18DROP TABLE IF EXISTS `test`.`t1`;
19COMMIT;
20START TRANSACTION;
21CREATE 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;
22COMMIT;
23START TRANSACTION;
24INSERT INTO `test`.`t1` (`k1`,`k2`,`padding`) VALUES (1,1,'I love testing.');
25COMMIT;
26START TRANSACTION;
27INSERT INTO `test`.`t1` (`k1`,`k2`,`padding`) VALUES (2,2,'I hate testing.');
28COMMIT;
29START TRANSACTION;
30INSERT INTO `test`.`t1` (`k1`,`k2`,`padding`) VALUES (2,3,'I hate and love testing.');
31COMMIT;
32START TRANSACTION;
33INSERT INTO `test`.`t1` (`k1`,`k2`,`padding`) VALUES (3,3,'I adore testing.');
34COMMIT;
35START TRANSACTION;
36UPDATE `test`.`t1` SET `padding`='XXX' WHERE `k1`=1 AND `k2`=1;
37COMMIT;
38START TRANSACTION;
39UPDATE `test`.`t1` SET `padding`='YYY' WHERE `k1`=2 AND `k2`=2;
40UPDATE `test`.`t1` SET `padding`='YYY' WHERE `k1`=2 AND `k2`=3;
41COMMIT;
42START TRANSACTION;
43UPDATE `test`.`t1` SET `padding`='ZZZ' WHERE `k1`=2 AND `k2`=3;
44UPDATE `test`.`t1` SET `padding`='ZZZ' WHERE `k1`=3 AND `k2`=3;
45COMMIT;
46START TRANSACTION;
47UPDATE `test`.`t1` SET `padding`='AAA' WHERE `k1`=1 AND `k2`=1;
48UPDATE `test`.`t1` SET `padding`='AAA' WHERE `k1`=2 AND `k2`=2;
49UPDATE `test`.`t1` SET `padding`='AAA' WHERE `k1`=2 AND `k2`=3;
50UPDATE `test`.`t1` SET `padding`='AAA' WHERE `k1`=3 AND `k2`=3;
51COMMIT;
52START TRANSACTION;
53DROP TABLE `test`.`t1`;
54COMMIT;
55SET GLOBAL transaction_log_truncate_debug= true;
056
=== modified file 'plugin/transaction_log/tests/r/no_modification.result'
--- plugin/transaction_log/tests/r/no_modification.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/no_modification.result 2010-03-02 21:04:16 +0000
@@ -15,10 +15,10 @@
152 I hate testing.152 I hate testing.
16COMMIT;16COMMIT;
17START TRANSACTION;17START TRANSACTION;
18DROP TABLE IF EXISTS `t1`;18DROP TABLE IF EXISTS `test`.`t1`;
19COMMIT;19COMMIT;
20START TRANSACTION;20START TRANSACTION;
21CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );21CREATE 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;
22COMMIT;22COMMIT;
23START TRANSACTION;23START TRANSACTION;
24INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');24INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
2525
=== modified file 'plugin/transaction_log/tests/r/no_primary_key.result'
--- plugin/transaction_log/tests/r/no_primary_key.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/no_primary_key.result 2010-03-02 21:04:16 +0000
@@ -7,12 +7,12 @@
7ERROR HY000: Tables which are replicated require a primary key.7ERROR HY000: Tables which are replicated require a primary key.
8DROP TABLE t1;8DROP TABLE t1;
9START TRANSACTION;9START TRANSACTION;
10DROP TABLE IF EXISTS `t1`;10DROP TABLE IF EXISTS `test`.`t1`;
11COMMIT;11COMMIT;
12START TRANSACTION;12START TRANSACTION;
13CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL );13CREATE TABLE `t1` ( `id` INT NOT NULL, `padding` VARCHAR(200) NOT NULL COLLATE utf8_general_ci ) ENGINE = InnoDB COLLATE = utf8_general_ci;
14COMMIT;14COMMIT;
15START TRANSACTION;15START TRANSACTION;
16DROP TABLE `t1`;16DROP TABLE `test`.`t1`;
17COMMIT;17COMMIT;
18SET GLOBAL transaction_log_truncate_debug= true;18SET GLOBAL transaction_log_truncate_debug= true;
1919
=== modified file 'plugin/transaction_log/tests/r/rand.result'
--- plugin/transaction_log/tests/r/rand.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/rand.result 2010-03-02 21:04:16 +0000
@@ -7,10 +7,10 @@
7INSERT INTO t1 SELECT RAND(100)*100 FROM t1;7INSERT INTO t1 SELECT RAND(100)*100 FROM t1;
8DROP TABLE t1;8DROP TABLE t1;
9START TRANSACTION;9START TRANSACTION;
10DROP TABLE IF EXISTS `t1`;10DROP TABLE IF EXISTS `test`.`t1`;
11COMMIT;11COMMIT;
12START TRANSACTION;12START TRANSACTION;
13CREATE TABLE t1 ( id INT NOT NULL , PRIMARY KEY (id) );13CREATE TABLE `t1` ( `id` INT NOT NULL, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
14COMMIT;14COMMIT;
15START TRANSACTION;15START TRANSACTION;
16INSERT INTO `test`.`t1` (`id`) VALUES (1);16INSERT INTO `test`.`t1` (`id`) VALUES (1);
@@ -19,6 +19,6 @@
19INSERT INTO `test`.`t1` (`id`) VALUES (17);19INSERT INTO `test`.`t1` (`id`) VALUES (17);
20COMMIT;20COMMIT;
21START TRANSACTION;21START TRANSACTION;
22DROP TABLE `t1`;22DROP TABLE `test`.`t1`;
23COMMIT;23COMMIT;
24SET GLOBAL transaction_log_truncate_debug= true;24SET GLOBAL transaction_log_truncate_debug= true;
2525
=== modified file 'plugin/transaction_log/tests/r/rename.result'
--- plugin/transaction_log/tests/r/rename.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/rename.result 2010-03-02 21:04:16 +0000
@@ -6,13 +6,13 @@
6);6);
7RENAME TABLE t1 TO t2;7RENAME TABLE t1 TO t2;
8START TRANSACTION;8START TRANSACTION;
9DROP TABLE IF EXISTS `t1`;9DROP TABLE IF EXISTS `test`.`t1`;
10COMMIT;10COMMIT;
11START TRANSACTION;11START TRANSACTION;
12DROP TABLE IF EXISTS `t2`;12DROP TABLE IF EXISTS `test`.`t2`;
13COMMIT;13COMMIT;
14START TRANSACTION;14START TRANSACTION;
15CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );15CREATE 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;
16COMMIT;16COMMIT;
17START TRANSACTION;17START TRANSACTION;
18RENAME TABLE t1 TO t2;18RENAME TABLE t1 TO t2;
1919
=== modified file 'plugin/transaction_log/tests/r/replace.result'
--- plugin/transaction_log/tests/r/replace.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/replace.result 2010-03-02 21:04:16 +0000
@@ -21,13 +21,13 @@
21REPLACE INTO t1 VALUE (2, "I love testing.");21REPLACE INTO t1 VALUE (2, "I love testing.");
22DROP TABLE t2, t1;22DROP TABLE t2, t1;
23START TRANSACTION;23START TRANSACTION;
24DROP TABLE IF EXISTS `t1`;24DROP TABLE IF EXISTS `test`.`t1`;
25COMMIT;25COMMIT;
26START TRANSACTION;26START TRANSACTION;
27DROP TABLE IF EXISTS `t2`;27DROP TABLE IF EXISTS `test`.`t2`;
28COMMIT;28COMMIT;
29START TRANSACTION;29START TRANSACTION;
30CREATE TABLE t1 ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , padding VARCHAR(200) NOT NULL ) ENGINE=InnoDB;30CREATE 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;
31COMMIT;31COMMIT;
32START TRANSACTION;32START TRANSACTION;
33INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');33INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -39,13 +39,13 @@
39UPDATE `test`.`t1` SET `padding`='I love testing.' WHERE `id`=2;39UPDATE `test`.`t1` SET `padding`='I love testing.' WHERE `id`=2;
40COMMIT;40COMMIT;
41START TRANSACTION;41START TRANSACTION;
42DROP TABLE `t1`;42DROP TABLE `test`.`t1`;
43COMMIT;43COMMIT;
44START TRANSACTION;44START TRANSACTION;
45CREATE TABLE t1 ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY , padding VARCHAR(200) NOT NULL ) ENGINE=InnoDB;45CREATE 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;
46COMMIT;46COMMIT;
47START TRANSACTION;47START TRANSACTION;
48CREATE 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;48CREATE 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;
49COMMIT;49COMMIT;
50START TRANSACTION;50START TRANSACTION;
51INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');51INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -58,9 +58,9 @@
58INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I love testing.');58INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (2,'I love testing.');
59COMMIT;59COMMIT;
60START TRANSACTION;60START TRANSACTION;
61DROP TABLE `t2`;61DROP TABLE `test`.`t2`;
62COMMIT;62COMMIT;
63START TRANSACTION;63START TRANSACTION;
64DROP TABLE `t1`;64DROP TABLE `test`.`t1`;
65COMMIT;65COMMIT;
66SET GLOBAL transaction_log_truncate_debug= true;66SET GLOBAL transaction_log_truncate_debug= true;
6767
=== modified file 'plugin/transaction_log/tests/r/rollback.result'
--- plugin/transaction_log/tests/r/rollback.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/rollback.result 2010-03-02 21:04:16 +0000
@@ -13,12 +13,12 @@
13ROLLBACK;13ROLLBACK;
14DROP TABLE t1;14DROP TABLE t1;
15START TRANSACTION;15START TRANSACTION;
16DROP TABLE IF EXISTS `t1`;16DROP TABLE IF EXISTS `test`.`t1`;
17COMMIT;17COMMIT;
18START TRANSACTION;18START TRANSACTION;
19CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );19CREATE 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;
20COMMIT;20COMMIT;
21START TRANSACTION;21START TRANSACTION;
22DROP TABLE `t1`;22DROP TABLE `test`.`t1`;
23COMMIT;23COMMIT;
24SET GLOBAL transaction_log_truncate_debug= true;24SET GLOBAL transaction_log_truncate_debug= true;
2525
=== added file 'plugin/transaction_log/tests/r/schema.result'
--- plugin/transaction_log/tests/r/schema.result 1970-01-01 00:00:00 +0000
+++ plugin/transaction_log/tests/r/schema.result 2010-03-02 21:04:16 +0000
@@ -0,0 +1,13 @@
1DROP SCHEMA IF EXISTS my_new_schema;
2CREATE SCHEMA my_new_warnings;
3DROP SCHEMA my_new_warnings;
4START TRANSACTION;
5DROP SCHEMA `my_new_schema`;
6COMMIT;
7START TRANSACTION;
8CREATE SCHEMA `my_new_warnings` COLLATE utf8_general_ci;
9COMMIT;
10START TRANSACTION;
11DROP SCHEMA `my_new_warnings`;
12COMMIT;
13SET GLOBAL transaction_log_truncate_debug= true;
014
=== modified file 'plugin/transaction_log/tests/r/select_for_update.result'
--- plugin/transaction_log/tests/r/select_for_update.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/select_for_update.result 2010-03-02 21:04:16 +0000
@@ -19,10 +19,10 @@
19COMMIT;19COMMIT;
20DROP TABLE t1;20DROP TABLE t1;
21START TRANSACTION;21START TRANSACTION;
22DROP TABLE IF EXISTS `t1`;22DROP TABLE IF EXISTS `test`.`t1`;
23COMMIT;23COMMIT;
24START TRANSACTION;24START TRANSACTION;
25CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );25CREATE 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;
26COMMIT;26COMMIT;
27START TRANSACTION;27START TRANSACTION;
28INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');28INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -39,6 +39,6 @@
39UPDATE `test`.`t1` SET `id`=6 WHERE `id`=5;39UPDATE `test`.`t1` SET `id`=6 WHERE `id`=5;
40COMMIT;40COMMIT;
41START TRANSACTION;41START TRANSACTION;
42DROP TABLE `t1`;42DROP TABLE `test`.`t1`;
43COMMIT;43COMMIT;
44SET GLOBAL transaction_log_truncate_debug= true;44SET GLOBAL transaction_log_truncate_debug= true;
4545
=== modified file 'plugin/transaction_log/tests/r/temp_tables.result'
--- plugin/transaction_log/tests/r/temp_tables.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/temp_tables.result 2010-03-02 21:04:16 +0000
@@ -10,10 +10,10 @@
10DROP TABLE t1;10DROP TABLE t1;
11DROP TABLE t2;11DROP TABLE t2;
12START TRANSACTION;12START TRANSACTION;
13DROP TABLE IF EXISTS `t1`;13DROP TABLE IF EXISTS `test`.`t1`;
14COMMIT;14COMMIT;
15START TRANSACTION;15START TRANSACTION;
16DROP TABLE IF EXISTS `t2`;16DROP TABLE IF EXISTS `test`.`t2`;
17COMMIT;17COMMIT;
18START TRANSACTION;18START TRANSACTION;
19CREATE TABLE `t2` ( `id` int NOT NULL, `padding` varchar(200) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB;19CREATE TABLE `t2` ( `id` int NOT NULL, `padding` varchar(200) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB;
@@ -23,6 +23,6 @@
23INSERT INTO `test`.`t2` (`id`,`padding`) VALUES (2,'I hate testing.');23INSERT INTO `test`.`t2` (`id`,`padding`) VALUES (2,'I hate testing.');
24COMMIT;24COMMIT;
25START TRANSACTION;25START TRANSACTION;
26DROP TABLE `t2`;26DROP TABLE `test`.`t2`;
27COMMIT;27COMMIT;
28SET GLOBAL transaction_log_truncate_debug= true;28SET GLOBAL transaction_log_truncate_debug= true;
2929
=== modified file 'plugin/transaction_log/tests/r/truncate.result'
--- plugin/transaction_log/tests/r/truncate.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/truncate.result 2010-03-02 21:04:16 +0000
@@ -7,10 +7,10 @@
7INSERT INTO t1 VALUES (2, "I hate testing.");7INSERT INTO t1 VALUES (2, "I hate testing.");
8TRUNCATE TABLE t1;8TRUNCATE TABLE t1;
9START TRANSACTION;9START TRANSACTION;
10DROP TABLE IF EXISTS `t1`;10DROP TABLE IF EXISTS `test`.`t1`;
11COMMIT;11COMMIT;
12START TRANSACTION;12START TRANSACTION;
13CREATE TABLE t1 ( id INT NOT NULL PRIMARY KEY , padding VARCHAR(200) NOT NULL );13CREATE 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;
14COMMIT;14COMMIT;
15START TRANSACTION;15START TRANSACTION;
16INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');16INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
1717
=== modified file 'plugin/transaction_log/tests/r/truncate_log.result'
--- plugin/transaction_log/tests/r/truncate_log.result 2009-12-11 19:08:29 +0000
+++ plugin/transaction_log/tests/r/truncate_log.result 2010-03-02 21:04:16 +0000
@@ -5,6 +5,6 @@
5);5);
6INSERT INTO t1 VALUES (1, "I love testing.");6INSERT INTO t1 VALUES (1, "I love testing.");
7INSERT INTO t1 VALUES (2, "I hate testing.");7INSERT INTO t1 VALUES (2, "I hate testing.");
817var/master-data/transaction.log824var/master-data/transaction.log
9SET GLOBAL transaction_log_truncate_debug= true;9SET GLOBAL transaction_log_truncate_debug= true;
100var/master-data/transaction.log100var/master-data/transaction.log
1111
=== modified file 'plugin/transaction_log/tests/r/update.result'
--- plugin/transaction_log/tests/r/update.result 2009-12-23 14:24:22 +0000
+++ plugin/transaction_log/tests/r/update.result 2010-03-02 21:04:16 +0000
@@ -36,10 +36,10 @@
36UPDATE t1 SET id = 4 WHERE id = 2;36UPDATE t1 SET id = 4 WHERE id = 2;
37DROP TABLE t1;37DROP TABLE t1;
38START TRANSACTION;38START TRANSACTION;
39DROP TABLE IF EXISTS `t1`;39DROP TABLE IF EXISTS `test`.`t1`;
40COMMIT;40COMMIT;
41START TRANSACTION;41START TRANSACTION;
42CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );42CREATE 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;
43COMMIT;43COMMIT;
44START TRANSACTION;44START TRANSACTION;
45INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');45INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -55,10 +55,10 @@
55UPDATE `test`.`t1` SET `padding`='AAA' WHERE `id`=2;55UPDATE `test`.`t1` SET `padding`='AAA' WHERE `id`=2;
56COMMIT;56COMMIT;
57START TRANSACTION;57START TRANSACTION;
58DROP TABLE `t1`;58DROP TABLE `test`.`t1`;
59COMMIT;59COMMIT;
60START TRANSACTION;60START TRANSACTION;
61CREATE TABLE t1 ( id int AUTO_INCREMENT NOT NULL PRIMARY KEY , name varchar(1024) , alias varchar(1024) );61CREATE 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;
62COMMIT;62COMMIT;
63START TRANSACTION;63START TRANSACTION;
64INSERT INTO `test`.`t1` (`id`,`name`,`alias`) VALUES (1,'jeff lebowski','dude');64INSERT INTO `test`.`t1` (`id`,`name`,`alias`) VALUES (1,'jeff lebowski','dude');
@@ -67,10 +67,10 @@
67UPDATE `test`.`t1` SET `alias`='the dude' WHERE `id`=1;67UPDATE `test`.`t1` SET `alias`='the dude' WHERE `id`=1;
68COMMIT;68COMMIT;
69START TRANSACTION;69START TRANSACTION;
70DROP TABLE `t1`;70DROP TABLE `test`.`t1`;
71COMMIT;71COMMIT;
72START TRANSACTION;72START TRANSACTION;
73CREATE TABLE t1 ( id INT NOT NULL , counter INT NOT NULL , PRIMARY KEY (id) );73CREATE TABLE `t1` ( `id` INT NOT NULL, `counter` INT NOT NULL, PRIMARY KEY `PRIMARY` (`id`) ) ENGINE = InnoDB COLLATE = utf8_general_ci;
74COMMIT;74COMMIT;
75START TRANSACTION;75START TRANSACTION;
76INSERT INTO `test`.`t1` (`id`,`counter`) VALUES (1,1);76INSERT INTO `test`.`t1` (`id`,`counter`) VALUES (1,1);
@@ -85,10 +85,10 @@
85UPDATE `test`.`t1` SET `counter`=4 WHERE `id`=3;85UPDATE `test`.`t1` SET `counter`=4 WHERE `id`=3;
86COMMIT;86COMMIT;
87START TRANSACTION;87START TRANSACTION;
88DROP TABLE `t1`;88DROP TABLE `test`.`t1`;
89COMMIT;89COMMIT;
90START TRANSACTION;90START TRANSACTION;
91CREATE TABLE t1 ( id INT NOT NULL , padding VARCHAR(200) NOT NULL , PRIMARY KEY (id) );91CREATE 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;
92COMMIT;92COMMIT;
93START TRANSACTION;93START TRANSACTION;
94INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');94INSERT INTO `test`.`t1` (`id`,`padding`) VALUES (1,'I love testing.');
@@ -100,6 +100,6 @@
100UPDATE `test`.`t1` SET `id`=4 WHERE `id`=2;100UPDATE `test`.`t1` SET `id`=4 WHERE `id`=2;
101COMMIT;101COMMIT;
102START TRANSACTION;102START TRANSACTION;
103DROP TABLE `t1`;103DROP TABLE `test`.`t1`;
104COMMIT;104COMMIT;
105SET GLOBAL transaction_log_truncate_debug= true;105SET GLOBAL transaction_log_truncate_debug= true;
106106
=== added file 'plugin/transaction_log/tests/t/create_table-master.opt'
--- plugin/transaction_log/tests/t/create_table-master.opt 1970-01-01 00:00:00 +0000
+++ plugin/transaction_log/tests/t/create_table-master.opt 2010-03-02 21:04:16 +0000
@@ -0,0 +1,1 @@
1--default-replicator-enable --transaction-log-enable --scheduler=multi_thread
02
=== added file 'plugin/transaction_log/tests/t/create_table.inc'
--- plugin/transaction_log/tests/t/create_table.inc 1970-01-01 00:00:00 +0000
+++ plugin/transaction_log/tests/t/create_table.inc 2010-03-02 21:04:16 +0000
@@ -0,0 +1,53 @@
1#
2# Tests tons of different CREATE TABLE
3# variations and the replication stream
4#
5
6--disable_warnings
7DROP TABLE IF EXISTS t1;
8--enable_warnings
9
10# Test the field generation
11
12CREATE TABLE t1 (
13 autoinc_int_field INT NOT NULL AUTO_INCREMENT
14, null_int_field INT NULL
15, not_null_bigint_field BIGINT NOT NULL
16, null_bigint_field BIGINT NULL
17, not_null_int_field INT NOT NULL
18, null_varchar_field VARCHAR(100) NULL
19, not_null_varchar_field VARCHAR(100) NOT NULL
20, null_enum_field ENUM ('val1', 'val2') NULL
21, not_null_enum_field ENUM ('val1', 'val2') NOT NULL
22, null_date_field DATE NULL
23, not_null_date_field DATE NOT NULL
24, null_datetime_field DATETIME NULL
25, not_null_datetime_field DATETIME NOT NULL
26, null_blob_field BLOB NULL
27, not_null_blob_field BLOB NOT NULL
28, null_text_field TEXT NULL
29, not_null_text_field TEXT NOT NULL
30, null_timestamp_field TIMESTAMP NULL
31, not_null_timestamp_field TIMESTAMP NOT NULL
32, null_double_field DOUBLE NULL
33, not_null_double_field DOUBLE NOT NULL
34, null_decimal_field DECIMAL(10,2) NULL
35, not_null_decimal_field DECIMAL(10,2) NOT NULL
36, PRIMARY KEY (autoinc_int_field)
37);
38
39DROP TABLE t1;
40
41# Test the index generation
42
43CREATE TABLE t1 (
44 id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
45, key1 VARCHAR(10) NOT NULL
46, key2 DOUBLE NOT NULL
47, key3 BLOB NOT NULL
48, UNIQUE KEY (key1)
49, KEY named_key (key2)
50, KEY partial_key (key3(30))
51);
52
53DROP TABLE t1;
054
=== added file 'plugin/transaction_log/tests/t/create_table.test'
--- plugin/transaction_log/tests/t/create_table.test 1970-01-01 00:00:00 +0000
+++ plugin/transaction_log/tests/t/create_table.test 2010-03-02 21:04:16 +0000
@@ -0,0 +1,9 @@
1# Populate log with some records...
2--source ../plugin/transaction_log/tests/t/create_table.inc
3
4# Read in the transaction.log.
5
6--exec ../drizzled/message/transaction_reader var/master-data/transaction.log
7
8# Truncate the log file to reset for the next test
9--source ../plugin/transaction_log/tests/t/truncate_log.inc
010
=== removed file 'plugin/transaction_log/tests/t/database.inc'
--- plugin/transaction_log/tests/t/database.inc 2009-07-02 05:08:33 +0000
+++ plugin/transaction_log/tests/t/database.inc 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
1#
2# Simple test of the serial event log for CREATE DATABASE and
3# DROP DATABASE
4#
5# Create a database then drop a database
6#
7# We then use the transaction_reader in drizzled/message/ to read the events.
8#
9
10# CREATE DATABASE
11CREATE DATABASE test1;
12DROP DATABASE test1;
130
=== removed file 'plugin/transaction_log/tests/t/database.test'
--- plugin/transaction_log/tests/t/database.test 2009-12-04 18:50:04 +0000
+++ plugin/transaction_log/tests/t/database.test 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
1#
2# Tests simple CREATE DATABASE and DROP DATABASE statements and the transaction log
3#
4
5# Populate log with some records...
6--source ../plugin/transaction_log/tests/t/database.inc
7
8# Read in the transaction.log.
9
10--exec ../drizzled/message/transaction_reader var/master-data/transaction.log
11
12# Truncate the log file to reset for the next test
13--source ../plugin/transaction_log/tests/t/truncate_log.inc
140
=== modified file 'plugin/transaction_log/tests/t/filtered_replicator.test'
--- plugin/transaction_log/tests/t/filtered_replicator.test 2009-12-04 18:50:04 +0000
+++ plugin/transaction_log/tests/t/filtered_replicator.test 2010-03-02 21:04:16 +0000
@@ -16,7 +16,7 @@
16--source ../plugin/transaction_log/tests/t/insert_multi.inc16--source ../plugin/transaction_log/tests/t/insert_multi.inc
17--source ../plugin/transaction_log/tests/t/insert_select.inc17--source ../plugin/transaction_log/tests/t/insert_select.inc
18--source ../plugin/transaction_log/tests/t/alter.inc18--source ../plugin/transaction_log/tests/t/alter.inc
19--source ../plugin/transaction_log/tests/t/database.inc19--source ../plugin/transaction_log/tests/t/schema.inc
20--source ../plugin/transaction_log/tests/t/rename.inc20--source ../plugin/transaction_log/tests/t/rename.inc
21--source ../plugin/transaction_log/tests/t/delete.inc21--source ../plugin/transaction_log/tests/t/delete.inc
22--source ../plugin/transaction_log/tests/t/update.inc22--source ../plugin/transaction_log/tests/t/update.inc
2323
=== added file 'plugin/transaction_log/tests/t/multi_column_primary_key-master.opt'
--- plugin/transaction_log/tests/t/multi_column_primary_key-master.opt 1970-01-01 00:00:00 +0000
+++ plugin/transaction_log/tests/t/multi_column_primary_key-master.opt 2010-03-02 21:04:16 +0000
@@ -0,0 +1,1 @@
1--default-replicator-enable --transaction-log-enable --scheduler=multi_thread
02
=== added file 'plugin/transaction_log/tests/t/multi_column_primary_key.inc'
--- plugin/transaction_log/tests/t/multi_column_primary_key.inc 1970-01-01 00:00:00 +0000
+++ plugin/transaction_log/tests/t/multi_column_primary_key.inc 2010-03-02 21:04:16 +0000
@@ -0,0 +1,36 @@
1#
2# Test that tables with multi-column primary keys
3# are handled properly in replication
4#
5
6--disable_warnings
7DROP TABLE IF EXISTS t1;
8--enable_warnings
9
10CREATE TABLE t1 (
11 k1 INT NOT NULL
12, k2 INT NOT NULL
13, padding VARCHAR(200) NOT NULL
14, PRIMARY KEY (k1, k2)
15);
16
17INSERT INTO t1 VALUES (1, 1, "I love testing.");
18INSERT INTO t1 VALUES (2, 2, "I hate testing.");
19INSERT INTO t1 VALUES (2, 3, "I hate and love testing.");
20INSERT INTO t1 VALUES (3, 3, "I adore testing.");
21
22# Simple PK update on both columns
23UPDATE t1 SET padding= "XXX" WHERE k1= 1 AND k2= 1;
24
25# UPDATE all records in table matching first column
26# in primary key
27UPDATE t1 SET padding= "YYY" WHERE k1= 2;
28
29# UPDATE all records in table matching second column
30# in primary key
31UPDATE t1 SET padding= "ZZZ" WHERE k2= 3;
32
33# UPDATE all records in table
34UPDATE t1 SET padding= "AAA";
35
36DROP TABLE t1;
037
=== added file 'plugin/transaction_log/tests/t/multi_column_primary_key.test'
--- plugin/transaction_log/tests/t/multi_column_primary_key.test 1970-01-01 00:00:00 +0000
+++ plugin/transaction_log/tests/t/multi_column_primary_key.test 2010-03-02 21:04:16 +0000
@@ -0,0 +1,9 @@
1# Populate log with some records...
2--source ../plugin/transaction_log/tests/t/multi_column_primary_key.inc
3
4# Read in the transaction.log.
5
6--exec ../drizzled/message/transaction_reader var/master-data/transaction.log
7
8# Truncate the log file to reset for the next test
9--source ../plugin/transaction_log/tests/t/truncate_log.inc
010
=== added file 'plugin/transaction_log/tests/t/schema-master.opt'
--- plugin/transaction_log/tests/t/schema-master.opt 1970-01-01 00:00:00 +0000
+++ plugin/transaction_log/tests/t/schema-master.opt 2010-03-02 21:04:16 +0000
@@ -0,0 +1,1 @@
1--default-replicator-enable --transaction-log-enable --scheduler=multi_thread
02
=== added file 'plugin/transaction_log/tests/t/schema.inc'
--- plugin/transaction_log/tests/t/schema.inc 1970-01-01 00:00:00 +0000
+++ plugin/transaction_log/tests/t/schema.inc 2010-03-02 21:04:16 +0000
@@ -0,0 +1,12 @@
1#
2# Test CREATE SCHEMA, DROP SCHEMA, ALTER SCHEMA
3# and the replication stream
4#
5
6--disable_warnings
7DROP SCHEMA IF EXISTS my_new_schema;
8--enable_warnings
9
10CREATE SCHEMA my_new_warnings;
11
12DROP SCHEMA my_new_warnings;
013
=== added file 'plugin/transaction_log/tests/t/schema.test'
--- plugin/transaction_log/tests/t/schema.test 1970-01-01 00:00:00 +0000
+++ plugin/transaction_log/tests/t/schema.test 2010-03-02 21:04:16 +0000
@@ -0,0 +1,9 @@
1# Populate log with some records...
2--source ../plugin/transaction_log/tests/t/schema.inc
3
4# Read in the transaction.log.
5
6--exec ../drizzled/message/transaction_reader var/master-data/transaction.log
7
8# Truncate the log file to reset for the next test
9--source ../plugin/transaction_log/tests/t/truncate_log.inc
010
=== modified file 'tests/r/innodb.result'
--- tests/r/innodb.result 2010-03-01 22:24:10 +0000
+++ tests/r/innodb.result 2010-03-02 21:04:16 +0000
@@ -1130,24 +1130,24 @@
1130checksum table t1, t2, t3, t4;1130checksum table t1, t2, t3, t4;
1131Table Checksum1131Table Checksum
1132test.t1 29486970751132test.t1 2948697075
1133test.t2 29486970751133test.t2 3505595080
1134test.t3 29486970751134test.t3 3505595080
1135test.t4 NULL1135test.t4 NULL
1136Warnings:1136Warnings:
1137Error 1146 Table 'test.t4' doesn't exist1137Error 1146 Table 'test.t4' doesn't exist
1138checksum table t1, t2, t3, t4;1138checksum table t1, t2, t3, t4;
1139Table Checksum1139Table Checksum
1140test.t1 29486970751140test.t1 2948697075
1141test.t2 29486970751141test.t2 3505595080
1142test.t3 29486970751142test.t3 3505595080
1143test.t4 NULL1143test.t4 NULL
1144Warnings:1144Warnings:
1145Error 1146 Table 'test.t4' doesn't exist1145Error 1146 Table 'test.t4' doesn't exist
1146checksum table t1, t2, t3, t4;1146checksum table t1, t2, t3, t4;
1147Table Checksum1147Table Checksum
1148test.t1 29486970751148test.t1 2948697075
1149test.t2 29486970751149test.t2 3505595080
1150test.t3 29486970751150test.t3 3505595080
1151test.t4 NULL1151test.t4 NULL
1152Warnings:1152Warnings:
1153Error 1146 Table 'test.t4' doesn't exist1153Error 1146 Table 'test.t4' doesn't exist
11541154
=== modified file 'tests/r/mix2_myisam.result'
--- tests/r/mix2_myisam.result 2010-02-19 19:04:24 +0000
+++ tests/r/mix2_myisam.result 2010-03-02 21:04:16 +0000
@@ -898,30 +898,30 @@
898Table Checksum898Table Checksum
899test.t1 2948697075899test.t1 2948697075
900test.t2 2948697075900test.t2 2948697075
901test.t3 2948697075901test.t3 3505595080
902test.t4 2948697075902test.t4 3505595080
903test.t5 2948697075903test.t5 2948697075
904test.t6 2948697075904test.t6 2948697075
905test.t7 NULL905test.t7 NULL
906Warnings:906Warnings:
907Error 1146 Table 'test.t7' doesn't exist907Error 1146 Table 'test.t7' doesn't exist
908checksum table t1, t2, t3, t4, t5, t6, t7;908checksum table t1, t2, t3, t4, t5, t6, t7;
909Table Checksum909Table Checksum
910test.t1 2948697075910test.t1 2948697075
911test.t2 2948697075911test.t2 2948697075
912test.t3 2948697075912test.t3 3505595080
913test.t4 2948697075913test.t4 3505595080
914test.t5 2948697075914test.t5 2948697075
915test.t6 2948697075915test.t6 2948697075
916test.t7 NULL916test.t7 NULL
917Warnings:917Warnings:
918Error 1146 Table 'test.t7' doesn't exist918Error 1146 Table 'test.t7' doesn't exist
919checksum table t1, t2, t3, t4, t5, t6, t7;919checksum table t1, t2, t3, t4, t5, t6, t7;
920Table Checksum920Table Checksum
921test.t1 2948697075921test.t1 2948697075
922test.t2 2948697075922test.t2 2948697075
923test.t3 2948697075923test.t3 3505595080
924test.t4 2948697075924test.t4 3505595080
925test.t5 2948697075925test.t5 2948697075
926test.t6 2948697075926test.t6 2948697075
927test.t7 NULL927test.t7 NULL
928928
=== modified file 'tests/r/myisam.result'
--- tests/r/myisam.result 2010-03-01 22:24:10 +0000
+++ tests/r/myisam.result 2010-03-02 21:04:16 +0000
@@ -490,22 +490,22 @@
490insert t2 select * from t1;490insert t2 select * from t1;
491checksum table t1, t2, t3;491checksum table t1, t2, t3;
492Table Checksum492Table Checksum
493test.t1 2948697075493test.t1 3505595080
494test.t2 2948697075494test.t2 3505595080
495test.t3 NULL495test.t3 NULL
496Warnings:496Warnings:
497Error 1146 Table 'test.t3' doesn't exist497Error 1146 Table 'test.t3' doesn't exist
498checksum table t1, t2, t3;498checksum table t1, t2, t3;
499Table Checksum499Table Checksum
500test.t1 2948697075500test.t1 3505595080
501test.t2 2948697075501test.t2 3505595080
502test.t3 NULL502test.t3 NULL
503Warnings:503Warnings:
504Error 1146 Table 'test.t3' doesn't exist504Error 1146 Table 'test.t3' doesn't exist
505checksum table t1, t2, t3;505checksum table t1, t2, t3;
506Table Checksum506Table Checksum
507test.t1 2948697075507test.t1 3505595080
508test.t2 2948697075508test.t2 3505595080
509test.t3 NULL509test.t3 NULL
510Warnings:510Warnings:
511Error 1146 Table 'test.t3' doesn't exist511Error 1146 Table 'test.t3' doesn't exist