~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to storage/innodb_plugin/trx/trx0i_s.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-21 15:31:05 UTC
  • mfrom: (1.1.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20100621153105-pbbz3t6nyrf9t2zq
Tags: upstream-5.1.48
ImportĀ upstreamĀ versionĀ 5.1.48

Show diffs side-by-side

added added

removed removed

Lines of Context:
429
429
                                                which to copy volatile
430
430
                                                strings */
431
431
{
 
432
        const char*     stmt;
 
433
        size_t          stmt_len;
 
434
 
432
435
        row->trx_id = trx_get_id(trx);
433
436
        row->trx_started = (ib_time_t) trx->start_time;
434
437
        row->trx_state = trx_get_que_state_str(trx);
449
452
 
450
453
        row->trx_weight = (ullint) ut_conv_dulint_to_longlong(TRX_WEIGHT(trx));
451
454
 
452
 
        if (trx->mysql_thd != NULL) {
453
 
                row->trx_mysql_thread_id
454
 
                        = thd_get_thread_id(trx->mysql_thd);
455
 
        } else {
 
455
        if (trx->mysql_thd == NULL) {
456
456
                /* For internal transactions e.g., purge and transactions
457
457
                being recovered at startup there is no associated MySQL
458
458
                thread data structure. */
459
459
                row->trx_mysql_thread_id = 0;
 
460
                row->trx_query = NULL;
 
461
                return(TRUE);
460
462
        }
461
463
 
462
 
        if (trx->mysql_query_str != NULL && *trx->mysql_query_str != NULL) {
463
 
 
464
 
                if (strlen(*trx->mysql_query_str)
465
 
                    > TRX_I_S_TRX_QUERY_MAX_LEN) {
466
 
 
467
 
                        char    query[TRX_I_S_TRX_QUERY_MAX_LEN + 1];
468
 
 
469
 
                        memcpy(query, *trx->mysql_query_str,
470
 
                               TRX_I_S_TRX_QUERY_MAX_LEN);
471
 
                        query[TRX_I_S_TRX_QUERY_MAX_LEN] = '\0';
472
 
 
473
 
                        row->trx_query = ha_storage_put_memlim(
474
 
                                cache->storage, query,
475
 
                                TRX_I_S_TRX_QUERY_MAX_LEN + 1,
476
 
                                MAX_ALLOWED_FOR_STORAGE(cache));
477
 
                } else {
478
 
 
479
 
                        row->trx_query = ha_storage_put_str_memlim(
480
 
                                cache->storage, *trx->mysql_query_str,
481
 
                                MAX_ALLOWED_FOR_STORAGE(cache));
 
464
        row->trx_mysql_thread_id = thd_get_thread_id(trx->mysql_thd);
 
465
        stmt = innobase_get_stmt(trx->mysql_thd, &stmt_len);
 
466
 
 
467
        if (stmt != NULL) {
 
468
 
 
469
                char    query[TRX_I_S_TRX_QUERY_MAX_LEN + 1];
 
470
 
 
471
                if (stmt_len > TRX_I_S_TRX_QUERY_MAX_LEN) {
 
472
                        stmt_len = TRX_I_S_TRX_QUERY_MAX_LEN;
482
473
                }
483
474
 
 
475
                memcpy(query, stmt, stmt_len);
 
476
                query[stmt_len] = '\0';
 
477
 
 
478
                row->trx_query = ha_storage_put_memlim(
 
479
                        cache->storage, stmt, stmt_len + 1,
 
480
                        MAX_ALLOWED_FOR_STORAGE(cache));
 
481
 
484
482
                if (row->trx_query == NULL) {
485
483
 
486
484
                        return(FALSE);