~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler.cc

  • Committer: Brian Aker
  • Date: 2009-02-02 18:19:36 UTC
  • mfrom: (820.1.14 nofrm)
  • Revision ID: brian@tangent.org-20090202181936-l03a2jb3vpndr1k3
Merge from Stewart.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include <drizzled/item/int.h>
41
41
#include <drizzled/item/empty_string.h>
42
42
#include <drizzled/unireg.h> // for mysql_frm_type
 
43
#include <drizzled/serialize/table.pb.h>
43
44
 
44
45
#if defined(CMATH_NAMESPACE)
45
46
using namespace CMATH_NAMESPACE;
1449
1450
    dummy_share.table_name.length= strlen(alias);
1450
1451
    dummy_table.alias= alias;
1451
1452
 
1452
 
    handler *file= dtargs.file;
1453
 
    file->change_table_ptr(&dummy_table, &dummy_share);
1454
 
 
1455
 
    session->push_internal_handler(&ha_delete_table_error_handler);
1456
 
    file->print_error(dtargs.error, 0);
1457
 
 
1458
 
    session->pop_internal_handler();
 
1453
    if(dtargs.file)
 
1454
    {
 
1455
      handler *file= dtargs.file;
 
1456
      file->change_table_ptr(&dummy_table, &dummy_share);
 
1457
 
 
1458
      session->push_internal_handler(&ha_delete_table_error_handler);
 
1459
      file->print_error(dtargs.error, 0);
 
1460
 
 
1461
      session->pop_internal_handler();
 
1462
    }
 
1463
    else
 
1464
      dtargs.error= -1; /* General form of fail. maybe bad FRM */
1459
1465
 
1460
1466
    /*
1461
1467
      XXX: should we convert *all* errors to warnings here?
3027
3033
 
3028
3034
    char path[FN_REFLEN];
3029
3035
    build_table_filename(path, sizeof(path),
3030
 
                         db, name, ".frm", 0);
 
3036
                         db, name, ".dfe", 0);
3031
3037
    if (!access(path, F_OK))
3032
3038
      args.err= HA_ERR_TABLE_EXIST;
3033
3039
    else
3034
3040
      args.err= HA_ERR_NO_SUCH_TABLE;
3035
3041
 
3036
 
    enum legacy_db_type table_type;
3037
 
    if(args.err==HA_ERR_TABLE_EXIST && mysql_frm_type(path, &table_type)==0)
 
3042
    if(args.err==HA_ERR_TABLE_EXIST)
3038
3043
    {
3039
 
      args.hton= ha_resolve_by_legacy_type(session, table_type);
 
3044
      drizzle::Table table;
 
3045
      if(drizzle_read_table_proto(path, &table)==0)
 
3046
      {
 
3047
        LEX_STRING engine_name= { (char*)table.engine().name().c_str(),
 
3048
                                 strlen(table.engine().name().c_str()) };
 
3049
        plugin_ref plugin= ha_resolve_by_name(session, &engine_name);
 
3050
        if(plugin)
 
3051
          args.hton= plugin_data(plugin,handlerton *);
 
3052
      }
3040
3053
    }
3041
3054
  }
3042
3055