~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/transaction_log/utilities/transaction_reader.cc

  • Committer: Lee Bieber
  • Date: 2010-12-09 19:40:05 UTC
  • mfrom: (1991.1.2 build)
  • Revision ID: kalebral@gmail.com-20101209194005-hpxailmc9afmvelh
Remove disabling of drizzleslap test
Merge Shrews - fix bug 683147: Large row affecting statements failing mid-transaction may not get undone properly by TransactionServices if part of multi-message Transaction

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
 
51
51
static const char *replace_with_spaces= "\n\r";
52
52
 
53
 
static void printStatement(const message::Statement &statement)
 
53
static void printStatement(const message::Statement &statement, string &output)
54
54
{
55
55
  vector<string> sql_strings;
56
56
 
91
91
      }
92
92
    }
93
93
 
94
 
    cout << sql << ';' << endl;
 
94
    output.append(sql + ";\n");
95
95
  }
96
96
}
97
97
 
273
273
        cout << "\tRAW SQL\n";
274
274
        break;
275
275
      }
 
276
      case (message::Statement::ROLLBACK_STATEMENT):
 
277
      {
 
278
        cout << "\tROLLBACK STATEMENT\n";
 
279
        break;
 
280
      }
276
281
      default:
277
282
        cout << "\tUnhandled Statement Type\n";
278
283
    }
322
327
 
323
328
  last_trx_id= trx.transaction_id();
324
329
 
 
330
  vector<string> cached_statement_sql;
 
331
 
325
332
  for (x= 0; x < num_statements; ++x)
326
333
  {
327
334
    const message::Statement &statement= transaction.statement(x);
338
345
    if (statement.type() == message::Statement::ROLLBACK)
339
346
      should_commit= false;
340
347
 
341
 
    printStatement(statement);
 
348
    string output;
 
349
    printStatement(statement, output);
 
350
    
 
351
    if (isEndStatement(statement))
 
352
    {
 
353
      /* A complete, non-segmented statement */
 
354
      if (cached_statement_sql.empty() &&
 
355
          (statement.type() != message::Statement::ROLLBACK_STATEMENT))
 
356
      {
 
357
        cout << output;
 
358
      }
 
359
      
 
360
      /* A segmented statement that was rolled back */
 
361
      else if (statement.type() == message::Statement::ROLLBACK_STATEMENT)
 
362
      {
 
363
        cached_statement_sql.clear();
 
364
        cout << "-- Rollback statement\n";
 
365
      }
 
366
      
 
367
      /* A segmented statement that was successfully executed */
 
368
      else
 
369
      {
 
370
        for (int y= 0; y < cached_statement_sql.size(); y++)
 
371
        {
 
372
          cout << cached_statement_sql[y];
 
373
        }
 
374
        cached_statement_sql.clear();
 
375
      }
 
376
    }
 
377
    
 
378
    /*
 
379
     * We cache segmented statements so we can support rolling back a
 
380
     * statement that fails mid-execution.
 
381
     */
 
382
    else
 
383
    {
 
384
      cached_statement_sql.push_back(output);
 
385
    }
342
386
  }
343
387
 
344
388
  /*