~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.h

  • Committer: Brian Aker
  • Date: 2010-11-15 05:43:10 UTC
  • mto: (1932.2.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 1934.
  • Revision ID: brian@tangent.org-20101115054310-btag01iyploogsf3
Fix issue where session info might not be correct.

Show diffs side-by-side

added added

removed removed

Lines of Context:
393
393
    return lex;
394
394
  }
395
395
  /** query associated with this statement */
396
 
  std::string query;
 
396
  typedef boost::shared_ptr<std::string> QueryString;
 
397
private:
 
398
  QueryString query;
 
399
 
 
400
  // Never allow for a modification of this outside of the class. c_str()
 
401
  // requires under some setup non const, you must copy the QueryString in
 
402
  // order to use it.
 
403
public:
 
404
  const QueryString getQueryString() const
 
405
  {
 
406
    return query;
 
407
  }
 
408
 
 
409
  void resetQueryString()
 
410
  {
 
411
    return query.reset(new std::string);
 
412
  }
 
413
 
 
414
  /*
 
415
    We need to copy the lock on the string in order to make sure we have a stable string.
 
416
    Once this is done we can use it to build a const char* which can be handed off for
 
417
    a method to use (Innodb is currently the only engine using this).
 
418
  */
 
419
  const char *getQueryStringCopy(size_t &length)
 
420
  {
 
421
    QueryString tmp_string(getQueryString());
 
422
 
 
423
    length= tmp_string->length();
 
424
    char *to_return= strmake(tmp_string->c_str(), tmp_string->length());
 
425
    return to_return;
 
426
  }
397
427
 
398
428
  /**
399
429
    Name of the current (default) database.
462
492
  }
463
493
 
464
494
  /**
465
 
   * A peek into the query string for the session. This is a best effort
466
 
   * delivery, there is no guarantee whether the content is meaningful.
467
 
   */
468
 
  char process_list_info[PROCESS_LIST_WIDTH+1];
469
 
 
470
 
  /**
471
495
   * A pointer to the stack frame of the scheduler thread
472
496
   * which is called first in the thread for handling a client
473
497
   */
933
957
    return warn_query_id;
934
958
  }
935
959
 
936
 
  /** Returns the current query text */
937
 
  inline const std::string &getQueryString()  const
938
 
  {
939
 
    return query;
940
 
  }
941
 
 
942
 
  /** Returns the length of the current query text */
943
 
  inline size_t getQueryLength() const
944
 
  {
945
 
    if (! query.empty())
946
 
      return query.length();
947
 
    else
948
 
      return 0;
949
 
  }
950
 
 
951
960
  /** Accessor method returning the session's ID. */
952
961
  inline session_id_t getSessionId()  const
953
962
  {