~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/create_table.cc

  • Committer: tdavies
  • Date: 2010-10-13 01:29:12 UTC
  • mto: (1842.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1843.
  • Revision ID: tdavies@molly-20101013012912-vl72hg1y99qgqz5m
File: /drizzled/xid.h. Changed struct name of 'st_drizzle_xid' to 'drizzle_xid', changed it to a C++ class and added constructor initialization list 

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
  TableList *create_table= session->lex->unlink_first_table(&link_to_local);
81
81
  TableList *select_tables= session->lex->query_tables;
82
82
 
83
 
  drizzled::message::init(create_table_message, create_table_message.name(), create_table->getSchemaName(), create_info.db_type->getName());
 
83
  drizzled::message::init(create_table_message, create_table_message.name(), create_table->db, create_info.db_type->getName());
84
84
 
85
 
  TableIdentifier new_table_identifier(create_table->getSchemaName(),
86
 
                                       create_table->getTableName(),
 
85
  TableIdentifier new_table_identifier(create_table->db,
 
86
                                       create_table->table_name,
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;