~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/db.cc

  • Committer: lbieber
  • Date: 2010-10-02 19:48:35 UTC
  • mfrom: (1730.6.19 drizzle-make-lcov)
  • Revision ID: lbieber@orisndriz08-20101002194835-q5zd9qc4lvx1xnfo
Merge Hartmut - clean up lex, now require flex to build, also "make lcov" improvements

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
 
17
17
/* create and drop of databases */
25
25
#include <string>
26
26
#include <fstream>
27
27
 
 
28
#include <drizzled/message/schema.pb.h>
28
29
#include "drizzled/error.h"
29
30
#include <drizzled/gettext.h>
30
31
#include <drizzled/my_hash.h>
45
46
 
46
47
#include <boost/thread/mutex.hpp>
47
48
 
 
49
boost::mutex LOCK_create_db;
 
50
 
48
51
#include "drizzled/internal/my_sys.h"
49
52
 
50
53
#define MAX_DROP_TABLE_Q_LEN      1024
54
57
namespace drizzled
55
58
{
56
59
 
57
 
static void change_db_impl(Session *session);
58
 
static void change_db_impl(Session *session, identifier::Schema &schema_identifier);
 
60
static long drop_tables_via_filenames(Session *session,
 
61
                                 SchemaIdentifier &schema_identifier,
 
62
                                 TableIdentifiers &dropped_tables);
 
63
static void mysql_change_db_impl(Session *session);
 
64
static void mysql_change_db_impl(Session *session, SchemaIdentifier &schema_identifier);
59
65
 
60
66
/*
61
67
  Create a database
62
68
 
63
69
  SYNOPSIS
64
 
  create_db()
 
70
  mysql_create_db()
65
71
  session               Thread handler
66
72
  db            Name of database to create
67
73
                Function assumes that this is already validated.
78
84
 
79
85
*/
80
86
 
81
 
bool create_db(Session *session, const message::Schema &schema_message, const bool is_if_not_exists)
 
87
bool mysql_create_db(Session *session, const message::Schema &schema_message, const bool is_if_not_exists)
82
88
{
83
89
  TransactionServices &transaction_services= TransactionServices::singleton();
84
90
  bool error= false;
85
91
 
86
92
  /*
87
93
    Do not create database if another thread is holding read lock.
88
 
    Wait for global read lock before acquiring session->catalog()->schemaLock().
 
94
    Wait for global read lock before acquiring LOCK_create_db.
89
95
    After wait_if_global_read_lock() we have protection against another
90
 
    global read lock. If we would acquire session->catalog()->schemaLock() first,
 
96
    global read lock. If we would acquire LOCK_create_db first,
91
97
    another thread could step in and get the global read lock before we
92
98
    reach wait_if_global_read_lock(). If this thread tries the same as we
93
 
    (admin a db), it would then go and wait on session->catalog()->schemaLock()...
 
99
    (admin a db), it would then go and wait on LOCK_create_db...
94
100
    Furthermore wait_if_global_read_lock() checks if the current thread
95
101
    has the global read lock and refuses the operation with
96
102
    ER_CANT_UPDATE_WITH_READLOCK if applicable.
97
103
  */
98
 
  if (session->wait_if_global_read_lock(false, true))
 
104
  if (wait_if_global_read_lock(session, 0, 1))
99
105
  {
100
106
    return false;
101
107
  }
105
111
 
106
112
  // @todo push this lock down into the engine
107
113
  {
108
 
    boost::mutex::scoped_lock scopedLock(session->catalog().schemaLock());
 
114
    boost::mutex::scoped_lock scopedLock(LOCK_create_db);
109
115
 
110
116
    // Check to see if it exists already.  
111
 
    identifier::Schema schema_identifier(schema_message.name());
 
117
    SchemaIdentifier schema_identifier(schema_message.name());
112
118
    if (plugin::StorageEngine::doesSchemaExist(schema_identifier))
113
119
    {
114
120
      if (not is_if_not_exists)
115
121
      {
116
 
        my_error(ER_DB_CREATE_EXISTS, schema_identifier);
 
122
        my_error(ER_DB_CREATE_EXISTS, MYF(0), schema_message.name().c_str());
117
123
        error= true;
118
124
      }
119
125
      else
131
137
    }
132
138
    else // Created !
133
139
    {
134
 
      transaction_services.createSchema(*session, schema_message);
 
140
      transaction_services.createSchema(session, schema_message);
135
141
      session->my_ok(1);
136
142
    }
137
143
  }
138
 
  session->startWaitingGlobalReadLock();
 
144
  start_waiting_global_read_lock(session);
139
145
 
140
146
  return error;
141
147
}
143
149
 
144
150
/* db-name is already validated when we come here */
145
151
 
146
 
bool alter_db(Session *session,
147
 
              const message::Schema &schema_message,
148
 
              const message::schema::shared_ptr &original_schema)
 
152
bool mysql_alter_db(Session *session, const message::Schema &schema_message)
149
153
{
150
154
  TransactionServices &transaction_services= TransactionServices::singleton();
151
155
 
152
156
  /*
153
157
    Do not alter database if another thread is holding read lock.
154
 
    Wait for global read lock before acquiring session->catalog()->schemaLock().
 
158
    Wait for global read lock before acquiring LOCK_create_db.
155
159
    After wait_if_global_read_lock() we have protection against another
156
 
    global read lock. If we would acquire session->catalog()->schemaLock() first,
 
160
    global read lock. If we would acquire LOCK_create_db first,
157
161
    another thread could step in and get the global read lock before we
158
162
    reach wait_if_global_read_lock(). If this thread tries the same as we
159
 
    (admin a db), it would then go and wait on session->catalog()->schemaLock()...
 
163
    (admin a db), it would then go and wait on LOCK_create_db...
160
164
    Furthermore wait_if_global_read_lock() checks if the current thread
161
165
    has the global read lock and refuses the operation with
162
166
    ER_CANT_UPDATE_WITH_READLOCK if applicable.
163
167
  */
164
 
  if ((session->wait_if_global_read_lock(false, true)))
 
168
  if ((wait_if_global_read_lock(session, 0, 1)))
165
169
    return false;
166
170
 
167
171
  bool success;
168
172
  {
169
 
    boost::mutex::scoped_lock scopedLock(session->catalog().schemaLock());
 
173
    boost::mutex::scoped_lock scopedLock(LOCK_create_db);
170
174
 
171
 
    identifier::Schema schema_idenifier(schema_message.name());
 
175
    SchemaIdentifier schema_idenifier(schema_message.name());
172
176
    if (not plugin::StorageEngine::doesSchemaExist(schema_idenifier))
173
177
    {
174
 
      my_error(ER_SCHEMA_DOES_NOT_EXIST, schema_idenifier);
 
178
      my_error(ER_SCHEMA_DOES_NOT_EXIST, MYF(0), schema_message.name().c_str());
175
179
      return false;
176
180
    }
177
181
 
180
184
 
181
185
    if (success)
182
186
    {
183
 
      transaction_services.alterSchema(*session, original_schema, schema_message);
 
187
      transaction_services.rawStatement(session, session->getQueryString());
184
188
      session->my_ok(1);
185
189
    }
186
190
    else
187
191
    {
188
 
      my_error(ER_ALTER_SCHEMA, schema_idenifier);
 
192
      my_error(ER_ALTER_SCHEMA, MYF(0), schema_message.name().c_str());
189
193
    }
190
194
  }
191
 
  session->startWaitingGlobalReadLock();
 
195
  start_waiting_global_read_lock(session);
192
196
 
193
197
  return success;
194
198
}
198
202
  Drop all tables in a database and the database itself
199
203
 
200
204
  SYNOPSIS
201
 
    rm_db()
 
205
    mysql_rm_db()
202
206
    session                     Thread handle
203
207
    db                  Database name in the case given by user
204
208
                        It's already validated and set to lower case
211
215
    ERROR Error
212
216
*/
213
217
 
214
 
bool rm_db(Session *session, identifier::Schema &schema_identifier, const bool if_exists)
 
218
bool mysql_rm_db(Session *session, SchemaIdentifier &schema_identifier, const bool if_exists)
215
219
{
216
 
  bool error= false;
 
220
  long deleted=0;
 
221
  int error= false;
 
222
  TableIdentifiers dropped_tables;
 
223
  message::Schema schema_proto;
217
224
 
218
225
  /*
219
226
    Do not drop database if another thread is holding read lock.
220
 
    Wait for global read lock before acquiring session->catalog()->schemaLock().
 
227
    Wait for global read lock before acquiring LOCK_create_db.
221
228
    After wait_if_global_read_lock() we have protection against another
222
 
    global read lock. If we would acquire session->catalog()->schemaLock() first,
 
229
    global read lock. If we would acquire LOCK_create_db first,
223
230
    another thread could step in and get the global read lock before we
224
231
    reach wait_if_global_read_lock(). If this thread tries the same as we
225
 
    (admin a db), it would then go and wait on session->catalog()->schemaLock()...
 
232
    (admin a db), it would then go and wait on LOCK_create_db...
226
233
    Furthermore wait_if_global_read_lock() checks if the current thread
227
234
    has the global read lock and refuses the operation with
228
235
    ER_CANT_UPDATE_WITH_READLOCK if applicable.
229
236
  */
230
 
  if (session->wait_if_global_read_lock(false, true))
231
 
  {
232
 
    return true;
233
 
  }
234
 
 
235
 
  do
236
 
  {
237
 
    boost::mutex::scoped_lock scopedLock(session->catalog().schemaLock());
 
237
  if (wait_if_global_read_lock(session, 0, 1))
 
238
  {
 
239
    return -1;
 
240
  }
 
241
 
 
242
  // Lets delete the temporary tables first outside of locks.  
 
243
  set<string> set_of_names;
 
244
  session->doGetTableNames(schema_identifier, set_of_names);
 
245
 
 
246
  for (set<string>::iterator iter= set_of_names.begin(); iter != set_of_names.end(); iter++)
 
247
  {
 
248
    TableIdentifier identifier(schema_identifier, *iter, message::Table::TEMPORARY);
 
249
    Table *table= session->find_temporary_table(identifier);
 
250
    session->close_temporary_table(table);
 
251
  }
 
252
 
 
253
  {
 
254
    boost::mutex::scoped_lock scopedLock(LOCK_create_db);
238
255
 
239
256
    /* See if the schema exists */
240
257
    if (not plugin::StorageEngine::doesSchemaExist(schema_identifier))
241
258
    {
242
259
      if (if_exists)
243
260
      {
244
 
        std::string path;
245
 
        schema_identifier.getSQLPath(path);
246
 
 
247
261
        push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
248
262
                            ER_DB_DROP_EXISTS, ER(ER_DB_DROP_EXISTS),
249
 
                            path.c_str());
 
263
                            schema_identifier.getSQLPath().c_str());
250
264
      }
251
265
      else
252
266
      {
253
 
        error= true;
254
 
        my_error(ER_DB_DROP_EXISTS, schema_identifier);
255
 
        break;
256
 
      }
257
 
    }
258
 
    else
259
 
    {
260
 
      error= plugin::StorageEngine::dropSchema(*session, schema_identifier);
261
 
    }
262
 
 
263
 
  } while (0);
264
 
 
265
 
  /*
266
 
    If this database was the client's selected database, we silently
267
 
    change the client's selected database to nothing (to have an empty
268
 
    SELECT DATABASE() in the future). For this we free() session->db and set
269
 
    it to 0.
270
 
  */
271
 
  if (not error and schema_identifier.compare(*session->schema()))
272
 
    change_db_impl(session);
273
 
 
274
 
  session->startWaitingGlobalReadLock();
 
267
        error= -1;
 
268
        my_error(ER_DB_DROP_EXISTS, MYF(0), schema_identifier.getSQLPath().c_str());
 
269
        goto exit;
 
270
      }
 
271
    }
 
272
    else
 
273
    {
 
274
      LOCK_open.lock(); /* After deleting database, remove all cache entries related to schema */
 
275
      remove_db_from_cache(schema_identifier);
 
276
      LOCK_open.unlock();
 
277
 
 
278
 
 
279
      error= -1;
 
280
      deleted= drop_tables_via_filenames(session, schema_identifier, dropped_tables);
 
281
      if (deleted >= 0)
 
282
      {
 
283
        error= 0;
 
284
      }
 
285
    }
 
286
    if (deleted >= 0)
 
287
    {
 
288
      assert(! session->query.empty());
 
289
 
 
290
      TransactionServices &transaction_services= TransactionServices::singleton();
 
291
      transaction_services.dropSchema(session, schema_identifier.getSchemaName());
 
292
      session->clear_error();
 
293
      session->server_status|= SERVER_STATUS_DB_DROPPED;
 
294
      session->my_ok((uint32_t) deleted);
 
295
      session->server_status&= ~SERVER_STATUS_DB_DROPPED;
 
296
    }
 
297
    else
 
298
    {
 
299
      char *query, *query_pos, *query_end, *query_data_start;
 
300
 
 
301
      if (!(query= (char*) session->alloc(MAX_DROP_TABLE_Q_LEN)))
 
302
        goto exit; /* not much else we can do */
 
303
      query_pos= query_data_start= strcpy(query,"drop table ")+11;
 
304
      query_end= query + MAX_DROP_TABLE_Q_LEN;
 
305
 
 
306
      TransactionServices &transaction_services= TransactionServices::singleton();
 
307
      for (TableIdentifiers::iterator it= dropped_tables.begin();
 
308
           it != dropped_tables.end();
 
309
           it++)
 
310
      {
 
311
        uint32_t tbl_name_len;
 
312
 
 
313
        /* 3 for the quotes and the comma*/
 
314
        tbl_name_len= (*it).getTableName().length() + 3;
 
315
        if (query_pos + tbl_name_len + 1 >= query_end)
 
316
        {
 
317
          /* These DDL methods and logging protected with LOCK_create_db */
 
318
          transaction_services.rawStatement(session, query);
 
319
          query_pos= query_data_start;
 
320
        }
 
321
 
 
322
        *query_pos++ = '`';
 
323
        query_pos= strcpy(query_pos, (*it).getTableName().c_str()) + (tbl_name_len-3);
 
324
        *query_pos++ = '`';
 
325
        *query_pos++ = ',';
 
326
      }
 
327
 
 
328
      if (query_pos != query_data_start)
 
329
      {
 
330
        /* These DDL methods and logging protected with LOCK_create_db */
 
331
        transaction_services.rawStatement(session, query);
 
332
      }
 
333
    }
 
334
 
 
335
exit:
 
336
    /*
 
337
      If this database was the client's selected database, we silently
 
338
      change the client's selected database to nothing (to have an empty
 
339
      SELECT DATABASE() in the future). For this we free() session->db and set
 
340
      it to 0.
 
341
    */
 
342
    if (schema_identifier.compare(session->db))
 
343
      mysql_change_db_impl(session);
 
344
  }
 
345
 
 
346
  start_waiting_global_read_lock(session);
275
347
 
276
348
  return error;
277
349
}
278
350
 
 
351
 
 
352
static int rm_table_part2(Session *session, TableList *tables)
 
353
{
 
354
  TransactionServices &transaction_services= TransactionServices::singleton();
 
355
 
 
356
  TableList *table;
 
357
  String wrong_tables;
 
358
  int error= 0;
 
359
  bool foreign_key_error= false;
 
360
 
 
361
  LOCK_open.lock(); /* Part 2 of rm a table */
 
362
 
 
363
  /*
 
364
    If we have the table in the definition cache, we don't have to check the
 
365
    .frm cursor to find if the table is a normal table (not view) and what
 
366
    engine to use.
 
367
  */
 
368
 
 
369
  for (table= tables; table; table= table->next_local)
 
370
  {
 
371
    TableIdentifier identifier(table->db, table->table_name);
 
372
    TableShare *share;
 
373
    table->setDbType(NULL);
 
374
    if ((share= TableShare::getShare(identifier)))
 
375
    {
 
376
      table->setDbType(share->db_type());
 
377
    }
 
378
  }
 
379
 
 
380
  if (lock_table_names_exclusively(session, tables))
 
381
  {
 
382
    LOCK_open.unlock();
 
383
    return 1;
 
384
  }
 
385
 
 
386
  /* Don't give warnings for not found errors, as we already generate notes */
 
387
  session->no_warnings_for_error= 1;
 
388
 
 
389
  for (table= tables; table; table= table->next_local)
 
390
  {
 
391
    char *db=table->db;
 
392
    plugin::StorageEngine *table_type;
 
393
 
 
394
    error= session->drop_temporary_table(table);
 
395
 
 
396
    switch (error) {
 
397
    case  0:
 
398
      // removed temporary table
 
399
      continue;
 
400
    case -1:
 
401
      error= 1;
 
402
      unlock_table_names(tables, NULL);
 
403
      LOCK_open.unlock();
 
404
      session->no_warnings_for_error= 0;
 
405
 
 
406
      return(error);
 
407
    default:
 
408
      // temporary table not found
 
409
      error= 0;
 
410
    }
 
411
 
 
412
    table_type= table->getDbType();
 
413
 
 
414
    TableIdentifier identifier(db, table->table_name);
 
415
 
 
416
    {
 
417
      Table *locked_table;
 
418
      abort_locked_tables(session, identifier);
 
419
      remove_table_from_cache(session, identifier,
 
420
                              RTFC_WAIT_OTHER_THREAD_FLAG |
 
421
                              RTFC_CHECK_KILLED_FLAG);
 
422
      /*
 
423
        If the table was used in lock tables, remember it so that
 
424
        unlock_table_names can free it
 
425
      */
 
426
      if ((locked_table= drop_locked_tables(session, identifier)))
 
427
        table->table= locked_table;
 
428
 
 
429
      if (session->killed)
 
430
      {
 
431
        error= -1;
 
432
        unlock_table_names(tables, NULL);
 
433
        LOCK_open.unlock();
 
434
        session->no_warnings_for_error= 0;
 
435
 
 
436
        return(error);
 
437
      }
 
438
    }
 
439
    identifier.getPath();
 
440
 
 
441
    if (table_type == NULL && not plugin::StorageEngine::doesTableExist(*session, identifier))
 
442
    {
 
443
      // Table was not found on disk and table can't be created from engine
 
444
      push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
 
445
                          ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
 
446
                          table->table_name);
 
447
    }
 
448
    else
 
449
    {
 
450
      error= plugin::StorageEngine::dropTable(*session, identifier);
 
451
 
 
452
      if ((error == ENOENT || error == HA_ERR_NO_SUCH_TABLE))
 
453
      {
 
454
        error= 0;
 
455
        session->clear_error();
 
456
      }
 
457
 
 
458
      if (error == HA_ERR_ROW_IS_REFERENCED)
 
459
      {
 
460
        /* the table is referenced by a foreign key constraint */
 
461
        foreign_key_error= true;
 
462
      }
 
463
    }
 
464
 
 
465
    if (error == 0 || (foreign_key_error == false))
 
466
    {
 
467
      transaction_services.dropTable(session, string(db), string(table->table_name), true);
 
468
    }
 
469
 
 
470
    if (error)
 
471
    {
 
472
      if (wrong_tables.length())
 
473
        wrong_tables.append(',');
 
474
      wrong_tables.append(String(table->table_name,system_charset_info));
 
475
    }
 
476
  }
 
477
  /*
 
478
    It's safe to unlock LOCK_open: we have an exclusive lock
 
479
    on the table name.
 
480
  */
 
481
  LOCK_open.unlock();
 
482
  error= 0;
 
483
  if (wrong_tables.length())
 
484
  {
 
485
    if (not foreign_key_error)
 
486
      my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
 
487
                      wrong_tables.c_ptr());
 
488
    else
 
489
    {
 
490
      my_message(ER_ROW_IS_REFERENCED, ER(ER_ROW_IS_REFERENCED), MYF(0));
 
491
    }
 
492
    error= 1;
 
493
  }
 
494
 
 
495
  LOCK_open.lock(); /* final bit in rm table lock */
 
496
  unlock_table_names(tables, NULL);
 
497
  LOCK_open.unlock();
 
498
  session->no_warnings_for_error= 0;
 
499
 
 
500
  return(error);
 
501
}
 
502
 
 
503
/*
 
504
  Removes files with known extensions plus.
 
505
  session MUST be set when calling this function!
 
506
*/
 
507
 
 
508
static long drop_tables_via_filenames(Session *session,
 
509
                                      SchemaIdentifier &schema_identifier,
 
510
                                      TableIdentifiers &dropped_tables)
 
511
{
 
512
  long deleted= 0;
 
513
  TableList *tot_list= NULL, **tot_list_next;
 
514
 
 
515
  tot_list_next= &tot_list;
 
516
 
 
517
  plugin::StorageEngine::getIdentifiers(*session, schema_identifier, dropped_tables);
 
518
 
 
519
  for (TableIdentifiers::iterator it= dropped_tables.begin();
 
520
       it != dropped_tables.end();
 
521
       it++)
 
522
  {
 
523
    size_t db_len= schema_identifier.getSchemaName().size();
 
524
 
 
525
    /* Drop the table nicely */
 
526
    TableList *table_list=(TableList*)
 
527
      session->calloc(sizeof(*table_list) +
 
528
                      db_len + 1 +
 
529
                      (*it).getTableName().length() + 1);
 
530
 
 
531
    if (not table_list)
 
532
      return -1;
 
533
 
 
534
    table_list->db= (char*) (table_list+1);
 
535
    table_list->table_name= strcpy(table_list->db, schema_identifier.getSchemaName().c_str()) + db_len + 1;
 
536
    TableIdentifier::filename_to_tablename((*it).getTableName().c_str(), table_list->table_name, (*it).getTableName().size() + 1);
 
537
    table_list->alias= table_list->table_name;  // If lower_case_table_names=2
 
538
    table_list->setInternalTmpTable((strncmp((*it).getTableName().c_str(),
 
539
                                             TMP_FILE_PREFIX,
 
540
                                             strlen(TMP_FILE_PREFIX)) == 0));
 
541
    /* Link into list */
 
542
    (*tot_list_next)= table_list;
 
543
    tot_list_next= &table_list->next_local;
 
544
    deleted++;
 
545
  }
 
546
  if (session->killed)
 
547
    return -1;
 
548
 
 
549
  if (tot_list)
 
550
  {
 
551
    if (rm_table_part2(session, tot_list))
 
552
      return -1;
 
553
  }
 
554
 
 
555
 
 
556
  if (not plugin::StorageEngine::dropSchema(schema_identifier))
 
557
  {
 
558
    my_error(ER_DROP_SCHEMA, MYF(0), schema_identifier.getSQLPath().c_str());
 
559
    return -1;
 
560
  }
 
561
 
 
562
  return deleted;
 
563
}
 
564
 
279
565
/**
280
566
  @brief Change the current database and its attributes unconditionally.
281
567
 
338
624
    @retval true  Error
339
625
*/
340
626
 
341
 
bool change_db(Session *session, identifier::Schema &schema_identifier)
 
627
bool mysql_change_db(Session *session, SchemaIdentifier &schema_identifier)
342
628
{
343
629
 
344
 
  if (not plugin::Authorization::isAuthorized(session->user(), schema_identifier))
 
630
  if (not plugin::Authorization::isAuthorized(session->getSecurityContext(), schema_identifier))
345
631
  {
346
632
    /* Error message is set in isAuthorized */
347
633
    return true;
349
635
 
350
636
  if (not check_db_name(session, schema_identifier))
351
637
  {
352
 
    my_error(ER_WRONG_DB_NAME, schema_identifier);
 
638
    my_error(ER_WRONG_DB_NAME, MYF(0), schema_identifier.getSQLPath().c_str());
353
639
 
354
640
    return true;
355
641
  }
356
642
 
357
643
  if (not plugin::StorageEngine::doesSchemaExist(schema_identifier))
358
644
  {
359
 
    my_error(ER_BAD_DB_ERROR, schema_identifier);
 
645
    /* Report an error and free new_db_file_name. */
 
646
 
 
647
    my_error(ER_BAD_DB_ERROR, MYF(0), schema_identifier.getSQLPath().c_str());
360
648
 
361
649
    /* The operation failed. */
362
650
 
363
651
    return true;
364
652
  }
365
653
 
366
 
  change_db_impl(session, schema_identifier);
 
654
  mysql_change_db_impl(session, schema_identifier);
367
655
 
368
656
  return false;
369
657
}
379
667
  @param new_db_charset Character set of the new database.
380
668
*/
381
669
 
382
 
static void change_db_impl(Session *session, identifier::Schema &schema_identifier)
 
670
static void mysql_change_db_impl(Session *session, SchemaIdentifier &schema_identifier)
383
671
{
384
672
  /* 1. Change current database in Session. */
385
673
 
406
694
  }
407
695
}
408
696
 
409
 
static void change_db_impl(Session *session)
 
697
static void mysql_change_db_impl(Session *session)
410
698
{
411
699
  session->set_db(string());
412
700
}