~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/create_table.cc

  • Committer: Brian Aker
  • Date: 2010-11-06 15:43:10 UTC
  • mfrom: (1908.1.1 merge)
  • Revision ID: brian@tangent.org-20101106154310-g1jpjzwbc53pfc4f
Filesort encapsulation, plus modification to copy contructor

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
                                       create_table->getTableName(),
87
87
                                       create_table_message.type());
88
88
 
89
 
  if (not check(new_table_identifier))
 
89
  if (create_table_precheck(new_table_identifier))
90
90
  {
91
91
    /* put tables back for PS rexecuting */
92
92
    session->lex->link_first_table_back(create_table, link_to_local);
109
109
     TABLE in the same way. That way we avoid that a new table is
110
110
     created during a gobal read lock.
111
111
   */
112
 
  if (! (need_start_waiting= not session->wait_if_global_read_lock(0, 1)))
 
112
  if (! (need_start_waiting= ! wait_if_global_read_lock(session, 0, 1)))
113
113
  {
114
114
    /* put tables back for PS rexecuting */
115
115
    session->lex->link_first_table_back(create_table, link_to_local);
146
146
             Release the protection against the global read lock and wake
147
147
             everyone, who might want to set a global read lock.
148
148
           */
149
 
          session->startWaitingGlobalReadLock();
 
149
          start_waiting_global_read_lock(session);
150
150
          /* put tables back for PS rexecuting */
151
151
          session->lex->link_first_table_back(create_table, link_to_local);
152
 
 
153
152
          return true;
154
153
        }
155
154
      }
225
224
     Release the protection against the global read lock and wake
226
225
     everyone, who might want to set a global read lock.
227
226
   */
228
 
  session->startWaitingGlobalReadLock();
 
227
  start_waiting_global_read_lock(session);
229
228
 
230
229
  return res;
231
230
}
232
231
 
233
 
bool statement::CreateTable::check(const TableIdentifier &identifier)
234
 
{
235
 
  // Check table name for validity
236
 
  if (not identifier.isValid())
237
 
    return false;
238
 
 
239
 
  // See if any storage engine objects to the name of the file
240
 
  if (not plugin::StorageEngine::canCreateTable(identifier))
241
 
  {
242
 
    my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), "", "", identifier.getSchemaName().c_str());
243
 
 
244
 
    return false;
245
 
  }
246
 
 
247
 
  // Make sure the schema exists, we will do this again during the actual
248
 
  // create for the table.
249
 
  if (not plugin::StorageEngine::doesSchemaExist(identifier))
250
 
  {
251
 
    my_error(ER_BAD_DB_ERROR, MYF(0), identifier.getSchemaName().c_str());
252
 
 
253
 
    return false;
254
 
  }
255
 
 
256
 
  return true;
257
 
}
258
 
 
259
232
bool statement::CreateTable::validateCreateTableOption()
260
233
{
261
234
  bool rc= true;