~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/cursor.cc

  • Committer: Eric Day
  • Date: 2010-03-25 19:28:37 UTC
  • mfrom: (1405 staging)
  • mto: This revision was merged to the branch mainline in revision 1409.
  • Revision ID: eday@oddments.org-20100325192837-4exmacbrywjovsqp
Merged trunk, rsolved conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include "drizzled/gettext.h"
33
33
#include "drizzled/probes.h"
34
34
#include "drizzled/sql_parse.h"
35
 
#include "drizzled/cost_vect.h"
 
35
#include "drizzled/optimizer/cost_vector.h"
36
36
#include "drizzled/session.h"
37
37
#include "drizzled/sql_base.h"
38
38
#include "drizzled/transaction_services.h"
962
962
Cursor::multi_range_read_info_const(uint32_t keyno, RANGE_SEQ_IF *seq,
963
963
                                     void *seq_init_param,
964
964
                                     uint32_t ,
965
 
                                     uint32_t *bufsz, uint32_t *flags, COST_VECT *cost)
 
965
                                     uint32_t *bufsz, uint32_t *flags, optimizer::CostVector *cost)
966
966
{
967
967
  KEY_MULTI_RANGE range;
968
968
  range_seq_t seq_it;
1005
1005
    /* The following calculation is the same as in multi_range_read_info(): */
1006
1006
    *flags |= HA_MRR_USE_DEFAULT_IMPL;
1007
1007
    cost->zero();
1008
 
    cost->avg_io_cost= 1; /* assume random seeks */
 
1008
    cost->setAvgIOCost(1); /* assume random seeks */
1009
1009
    if ((*flags & HA_MRR_INDEX_ONLY) && total_rows > 2)
1010
 
      cost->io_count= index_only_read_time(keyno, (uint32_t)total_rows);
 
1010
      cost->setIOCount(index_only_read_time(keyno, (uint32_t)total_rows));
1011
1011
    else
1012
 
      cost->io_count= read_time(keyno, n_ranges, total_rows);
1013
 
    cost->cpu_cost= (double) total_rows / TIME_FOR_COMPARE + 0.01;
 
1012
      cost->setIOCount(read_time(keyno, n_ranges, total_rows));
 
1013
    cost->setCpuCost((double) total_rows / TIME_FOR_COMPARE + 0.01);
1014
1014
  }
1015
1015
  return total_rows;
1016
1016
}
1051
1051
*/
1052
1052
 
1053
1053
int Cursor::multi_range_read_info(uint32_t keyno, uint32_t n_ranges, uint32_t n_rows,
1054
 
                                   uint32_t *bufsz, uint32_t *flags, COST_VECT *cost)
 
1054
                                   uint32_t *bufsz, uint32_t *flags, optimizer::CostVector *cost)
1055
1055
{
1056
1056
  *bufsz= 0; /* Default implementation doesn't need a buffer */
1057
1057
 
1058
1058
  *flags |= HA_MRR_USE_DEFAULT_IMPL;
1059
1059
 
1060
1060
  cost->zero();
1061
 
  cost->avg_io_cost= 1; /* assume random seeks */
 
1061
  cost->setAvgIOCost(1); /* assume random seeks */
1062
1062
 
1063
1063
  /* Produce the same cost as non-MRR code does */
1064
1064
  if (*flags & HA_MRR_INDEX_ONLY)
1065
 
    cost->io_count= index_only_read_time(keyno, n_rows);
 
1065
    cost->setIOCount(index_only_read_time(keyno, n_rows));
1066
1066
  else
1067
 
    cost->io_count= read_time(keyno, n_ranges, n_rows);
 
1067
    cost->setIOCount(read_time(keyno, n_ranges, n_rows));
1068
1068
  return 0;
1069
1069
}
1070
1070
 
1450
1450
  {
1451
1451
    if (lock_type == F_RDLCK)
1452
1452
    {
1453
 
      DRIZZLE_CURSOR_RDLOCK_START(table_share->db.str,
1454
 
                                  table_share->table_name.str);
 
1453
      DRIZZLE_CURSOR_RDLOCK_START(table_share->getSchemaName(),
 
1454
                                  table_share->getTableName());
1455
1455
    }
1456
1456
    else if (lock_type == F_WRLCK)
1457
1457
    {
1458
 
      DRIZZLE_CURSOR_WRLOCK_START(table_share->db.str,
1459
 
                                  table_share->table_name.str);
 
1458
      DRIZZLE_CURSOR_WRLOCK_START(table_share->getSchemaName(),
 
1459
                                  table_share->getTableName());
1460
1460
    }
1461
1461
    else if (lock_type == F_UNLCK)
1462
1462
    {
1463
 
      DRIZZLE_CURSOR_UNLOCK_START(table_share->db.str,
1464
 
                                  table_share->table_name.str);
 
1463
      DRIZZLE_CURSOR_UNLOCK_START(table_share->getSchemaName(),
 
1464
                                  table_share->getTableName());
1465
1465
    }
1466
1466
  }
1467
1467
 
1528
1528
  if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
1529
1529
    table->timestamp_field->set_time();
1530
1530
 
1531
 
  DRIZZLE_INSERT_ROW_START(table_share->db.str, table_share->table_name.str);
 
1531
  DRIZZLE_INSERT_ROW_START(table_share->getSchemaName(), table_share->getTableName());
1532
1532
  setTransactionReadWrite();
1533
1533
  error= write_row(buf);
1534
1534
  DRIZZLE_INSERT_ROW_DONE(error);
1555
1555
   */
1556
1556
  assert(new_data == table->record[0]);
1557
1557
 
1558
 
  DRIZZLE_UPDATE_ROW_START(table_share->db.str, table_share->table_name.str);
 
1558
  DRIZZLE_UPDATE_ROW_START(table_share->getSchemaName(), table_share->getTableName());
1559
1559
  setTransactionReadWrite();
1560
1560
  error= update_row(old_data, new_data);
1561
1561
  DRIZZLE_UPDATE_ROW_DONE(error);
1575
1575
{
1576
1576
  int error;
1577
1577
 
1578
 
  DRIZZLE_DELETE_ROW_START(table_share->db.str, table_share->table_name.str);
 
1578
  DRIZZLE_DELETE_ROW_START(table_share->getSchemaName(), table_share->getTableName());
1579
1579
  setTransactionReadWrite();
1580
1580
  error= delete_row(buf);
1581
1581
  DRIZZLE_DELETE_ROW_DONE(error);