~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler.cc

  • Committer: Brian Aker
  • Date: 2008-12-19 00:21:45 UTC
  • mfrom: (673.3.14 tests)
  • Revision ID: brian@tangent.org-20081219002145-o9blhzoh0shrih2u
Merge from Stewart.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#include <drizzled/lock.h>
40
40
#include <drizzled/item/int.h>
41
41
#include <drizzled/item/empty_string.h>
 
42
#include <drizzled/unireg.h> // for mysql_frm_type
42
43
 
43
44
#if defined(CMATH_NAMESPACE)
44
45
using namespace CMATH_NAMESPACE;
3002
3003
  const char *db;
3003
3004
  const char *name;
3004
3005
  int err;
 
3006
  handlerton* hton;
3005
3007
};
3006
3008
 
3007
3009
static bool table_exists_in_engine_handlerton(Session *session, plugin_ref plugin,
3017
3019
 
3018
3020
  vargs->err = err;
3019
3021
  if (vargs->err == HA_ERR_TABLE_EXIST)
 
3022
  {
 
3023
    vargs->hton= hton;
3020
3024
    return true;
 
3025
  }
3021
3026
 
3022
3027
  return false;
3023
3028
}
3024
3029
 
3025
 
int ha_table_exists_in_engine(Session* session, const char* db, const char* name)
 
3030
int ha_table_exists_in_engine(Session* session,
 
3031
                              const char* db, const char* name,
 
3032
                              handlerton **hton)
3026
3033
{
3027
 
  st_table_exists_in_engine_args args= {db, name, HA_ERR_NO_SUCH_TABLE};
 
3034
  st_table_exists_in_engine_args args= {db, name, HA_ERR_NO_SUCH_TABLE, NULL};
3028
3035
  plugin_foreach(session, table_exists_in_engine_handlerton,
3029
3036
                 DRIZZLE_STORAGE_ENGINE_PLUGIN, &args);
3030
3037
 
3039
3046
      args.err= HA_ERR_TABLE_EXIST;
3040
3047
    else
3041
3048
      args.err= HA_ERR_NO_SUCH_TABLE;
 
3049
 
 
3050
    enum legacy_db_type table_type;
 
3051
    if(args.err==HA_ERR_TABLE_EXIST && mysql_frm_type(path, &table_type)==0)
 
3052
    {
 
3053
      args.hton= ha_resolve_by_legacy_type(session, table_type);
 
3054
    }
3042
3055
  }
3043
3056
 
 
3057
  if(hton)
 
3058
    *hton= args.hton;
 
3059
 
3044
3060
  return(args.err);
3045
3061
}
3046
3062