~thomir-deactivatedaccount/drizzle/drizzle-fix-bug653747

« back to all changes in this revision

Viewing changes to plugin/haildb/haildb_engine.cc

Merge for Stewart

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
 
91
91
#include "drizzled/global_charset_info.h"
92
92
 
93
 
#include "haildb_version_func.h"
94
93
#include "haildb_datadict_dump_func.h"
95
94
#include "config_table_function.h"
96
95
#include "status_table_function.h"
97
96
 
98
 
#if defined(HAVE_HAILDB_H)
99
 
# include <haildb.h>
100
 
#else
101
 
# include <embedded_innodb-1.0/innodb.h>
102
 
#endif /* HAVE_HAILDB_H */
 
97
#include <haildb.h>
103
98
 
104
99
#include "haildb_engine.h"
105
100
 
2353
2348
 
2354
2349
double HailDBCursor::scan_time()
2355
2350
{
2356
 
  return 0.1;
 
2351
  ib_table_stats_t table_stats;
 
2352
  ib_err_t err;
 
2353
 
 
2354
  err= ib_get_table_statistics(cursor, &table_stats, sizeof(table_stats));
 
2355
 
 
2356
  /* Approximate I/O seeks for full table scan */
 
2357
  return (double) (table_stats.stat_clustered_index_size / 16384);
2357
2358
}
2358
2359
 
2359
2360
int HailDBCursor::info(uint32_t flag)
2360
2361
{
2361
 
  stats.records= 2;
 
2362
  ib_table_stats_t table_stats;
 
2363
  ib_err_t err;
 
2364
 
 
2365
  if (flag & HA_STATUS_VARIABLE)
 
2366
  {
 
2367
    err= ib_get_table_statistics(cursor, &table_stats, sizeof(table_stats));
 
2368
 
 
2369
    stats.records= table_stats.stat_n_rows;
 
2370
 
 
2371
    if (table_stats.stat_n_rows < 2)
 
2372
      stats.records= 2;
 
2373
 
 
2374
    stats.deleted= 0;
 
2375
    stats.data_file_length= table_stats.stat_clustered_index_size;
 
2376
    stats.index_file_length= table_stats.stat_sum_of_other_index_sizes;
 
2377
 
 
2378
    stats.mean_rec_length= stats.data_file_length / stats.records;
 
2379
  }
2362
2380
 
2363
2381
  if (flag & HA_STATUS_AUTO)
2364
2382
    stats.auto_increment_value= 1;
3219
3237
  haildb_engine= new HailDBEngine("InnoDB");
3220
3238
  context.add(haildb_engine);
3221
3239
 
3222
 
  haildb_version_func_initialize(context);
3223
3240
  haildb_datadict_dump_func_initialize(context);
3224
3241
  config_table_function_initialize(context);
3225
3242
  status_table_function_initialize(context);