~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_table.cc

  • Committer: Brian Aker
  • Date: 2011-01-11 05:13:54 UTC
  • mto: (2075.2.1 drizzle)
  • mto: This revision was merged to the branch mainline in revision 2076.
  • Revision ID: brian@tangent.org-20110111051354-m8ba2xvtjfldrler
First pass through error correction in SE interface for drop table.

Show diffs side-by-side

added added

removed removed

Lines of Context:
212
212
      }
213
213
      else
214
214
      {
215
 
        error= plugin::StorageEngine::dropTable(*session, identifier);
 
215
        drizzled::error_t local_error;
216
216
 
217
217
        /* Generate transaction event ONLY when we successfully drop */ 
218
 
        if (error == 0)
 
218
        if (plugin::StorageEngine::dropTable(*session, identifier, local_error))
219
219
        {
220
220
          TransactionServices &transaction_services= TransactionServices::singleton();
221
221
          transaction_services.dropTable(session, identifier, if_exists);
222
222
        }
223
 
 
224
 
        if ((error == ENOENT || error == HA_ERR_NO_SUCH_TABLE) && if_exists)
225
 
        {
226
 
          error= 0;
227
 
          session->clear_error();
228
 
        }
229
 
 
230
 
        if (error == HA_ERR_ROW_IS_REFERENCED)
231
 
        {
232
 
          /* the table is referenced by a foreign key constraint */
233
 
          foreign_key_error= true;
 
223
        else
 
224
        {
 
225
          if (local_error == HA_ERR_NO_SUCH_TABLE and if_exists)
 
226
          {
 
227
            error= 0;
 
228
            session->clear_error();
 
229
          }
 
230
 
 
231
          if (local_error == HA_ERR_ROW_IS_REFERENCED)
 
232
          {
 
233
            /* the table is referenced by a foreign key constraint */
 
234
            foreign_key_error= true;
 
235
          }
 
236
          error= local_error;
234
237
        }
235
238
      }
236
239