~jaypipes/drizzle/replication-ddl

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Jay Pipes
  • Date: 2010-04-01 18:42:31 UTC
  • mfrom: (1405.4.18 bad-staging)
  • Revision ID: jpipes@serialcoder-20100401184231-pigk7uoqoynmhqhk
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
383
383
 
384
384
Session::~Session()
385
385
{
386
 
  Session_CHECK_SENTRY(this);
 
386
  this->checkSentry();
387
387
  add_to_status(&global_status_var, &status_var);
388
388
 
389
389
  if (client->isConnected())
470
470
 
471
471
void Session::awake(Session::killed_state state_to_set)
472
472
{
473
 
  Session_CHECK_SENTRY(this);
 
473
  this->checkSentry();
474
474
  safe_mutex_assert_owner(&LOCK_delete);
475
475
 
476
476
  killed= state_to_set;
687
687
  /* Change database if necessary */
688
688
  if (in_db && in_db[0])
689
689
  {
690
 
    if (mysql_change_db(this, in_db))
 
690
    SchemaIdentifier identifier(in_db);
 
691
    if (mysql_change_db(this, identifier))
691
692
    {
692
693
      /* mysql_change_db() has pushed the error message. */
693
694
      return false;
1142
1143
  return 0;
1143
1144
}
1144
1145
 
1145
 
 
1146
 
#define NEED_ESCAPING(x) ((int) (unsigned char) (x) == escape_char    || \
1147
 
                          (enclosed ? (int) (unsigned char) (x) == field_sep_char      \
1148
 
                                    : (int) (unsigned char) (x) == field_term_char) || \
1149
 
                          (int) (unsigned char) (x) == line_sep_char  || \
1150
 
                          !(x))
1151
 
 
1152
1146
bool select_export::send_data(List<Item> &items)
1153
1147
{
1154
1148
  char buff[MAX_FIELD_WIDTH],null_buff[2],space[MAX_FIELD_WIDTH];
1265
1259
            assert before the loop makes that sure.
1266
1260
          */
1267
1261
 
1268
 
          if ((NEED_ESCAPING(*pos) ||
 
1262
          if ((needs_escaping(*pos, enclosed) ||
1269
1263
               (check_second_byte &&
1270
1264
                my_mbcharlen(character_set_client, (unsigned char) *pos) == 2 &&
1271
1265
                pos + 1 < end &&
1272
 
                NEED_ESCAPING(pos[1]))) &&
 
1266
                needs_escaping(pos[1], enclosed))) &&
1273
1267
              /*
1274
1268
                Don't escape field_term_char by doubling - doubling is only
1275
1269
                valid for ENCLOSED BY characters:
1623
1617
  set_open_tables_state(backup);
1624
1618
}
1625
1619
 
1626
 
bool Session::set_db(const char *new_db, size_t length)
 
1620
bool Session::set_db(const std::string &new_db)
1627
1621
{
1628
1622
  /* Do not reallocate memory if current chunk is big enough. */
1629
 
  if (length)
 
1623
  if (new_db.length())
1630
1624
    db= new_db;
1631
1625
  else
1632
1626
    db.clear();
2007
2001
    if (open_tables_from_list(&tables, &counter))
2008
2002
      return true;
2009
2003
 
2010
 
    if (!lock_tables(tables, counter, &need_reopen))
 
2004
    if (not lock_tables(tables, counter, &need_reopen))
2011
2005
      break;
2012
 
    if (!need_reopen)
 
2006
    if (not need_reopen)
2013
2007
      return true;
2014
2008
    close_tables_for_reopen(&tables);
2015
2009
  }