~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/ha_myisam.cc

  • Committer: Brian Aker
  • Date: 2011-02-17 10:09:00 UTC
  • mfrom: (2173.2.1 clean-include-usuage)
  • Revision ID: brian@tangent.org-20110217100900-4tpuxxzdl1sj00sh
Merge Monty for headers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
 
17
17
 
18
 
#include "config.h"
19
 
#include "drizzled/internal/my_bit.h"
 
18
#include <config.h>
 
19
#include <drizzled/internal/my_bit.h>
20
20
#include "myisampack.h"
21
21
#include "ha_myisam.h"
22
22
#include "myisam_priv.h"
23
 
#include "drizzled/option.h"
24
 
#include "drizzled/internal/my_bit.h"
25
 
#include "drizzled/internal/m_string.h"
26
 
#include "drizzled/util/test.h"
27
 
#include "drizzled/error.h"
28
 
#include "drizzled/errmsg_print.h"
29
 
#include "drizzled/gettext.h"
30
 
#include "drizzled/session.h"
31
 
#include "drizzled/plugin.h"
32
 
#include "drizzled/plugin/client.h"
33
 
#include "drizzled/table.h"
34
 
#include "drizzled/field/timestamp.h"
35
 
#include "drizzled/memory/multi_malloc.h"
36
 
#include "drizzled/plugin/daemon.h"
 
23
#include <drizzled/option.h>
 
24
#include <drizzled/internal/my_bit.h>
 
25
#include <drizzled/internal/m_string.h>
 
26
#include <drizzled/util/test.h>
 
27
#include <drizzled/error.h>
 
28
#include <drizzled/errmsg_print.h>
 
29
#include <drizzled/gettext.h>
 
30
#include <drizzled/session.h>
 
31
#include <drizzled/plugin.h>
 
32
#include <drizzled/plugin/client.h>
 
33
#include <drizzled/table.h>
 
34
#include <drizzled/memory/multi_malloc.h>
 
35
#include <drizzled/plugin/daemon.h>
 
36
 
 
37
#include <drizzled/plugin/storage_engine.h>
37
38
 
38
39
#include <boost/algorithm/string.hpp>
39
40
#include <boost/scoped_ptr.hpp>
117
118
 
118
119
  int doCreateTable(Session&,
119
120
                    Table& table_arg,
120
 
                    const TableIdentifier &identifier,
 
121
                    const identifier::Table &identifier,
121
122
                    message::Table&);
122
123
 
123
 
  int doRenameTable(Session&, const TableIdentifier &from, const TableIdentifier &to);
 
124
  int doRenameTable(Session&, const identifier::Table &from, const identifier::Table &to);
124
125
 
125
 
  int doDropTable(Session&, const TableIdentifier &identifier);
 
126
  int doDropTable(Session&, const identifier::Table &identifier);
126
127
 
127
128
  int doGetTableDefinition(Session& session,
128
 
                           const TableIdentifier &identifier,
 
129
                           const identifier::Table &identifier,
129
130
                           message::Table &table_message);
130
131
 
131
132
  uint32_t max_supported_keys()          const { return MI_MAX_KEY; }
140
141
            HA_READ_ORDER |
141
142
            HA_KEYREAD_ONLY);
142
143
  }
143
 
  bool doDoesTableExist(Session& session, const TableIdentifier &identifier);
 
144
  bool doDoesTableExist(Session& session, const identifier::Table &identifier);
144
145
 
145
146
  void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
146
 
                             const drizzled::SchemaIdentifier &schema_identifier,
147
 
                             drizzled::TableIdentifier::vector &set_of_identifiers);
 
147
                             const drizzled::identifier::Schema &schema_identifier,
 
148
                             drizzled::identifier::Table::vector &set_of_identifiers);
148
149
  bool validateCreateTableOption(const std::string &key, const std::string &state)
149
150
  {
150
151
    (void)state;
158
159
};
159
160
 
160
161
void MyisamEngine::doGetTableIdentifiers(drizzled::CachedDirectory&,
161
 
                                         const drizzled::SchemaIdentifier&,
162
 
                                         drizzled::TableIdentifier::vector&)
 
162
                                         const drizzled::identifier::Schema&,
 
163
                                         drizzled::identifier::Table::vector&)
163
164
{
164
165
}
165
166
 
166
 
bool MyisamEngine::doDoesTableExist(Session &session, const TableIdentifier &identifier)
 
167
bool MyisamEngine::doDoesTableExist(Session &session, const identifier::Table &identifier)
167
168
{
168
169
  return session.getMessageCache().doesTableMessageExist(identifier);
169
170
}
170
171
 
171
172
int MyisamEngine::doGetTableDefinition(Session &session,
172
 
                                       const TableIdentifier &identifier,
 
173
                                       const identifier::Table &identifier,
173
174
                                       message::Table &table_message)
174
175
{
175
176
  if (session.getMessageCache().getTableMessage(identifier, table_message))
285
286
        keydef[i].seg[j].flag|= HA_BLOB_PART;
286
287
        /* save number of bytes used to pack length */
287
288
        keydef[i].seg[j].bit_start= (uint) (field->pack_length() -
288
 
                                            share->blob_ptr_size);
 
289
                                            share->sizeBlobPtr());
289
290
      }
290
291
    }
291
292
    keyseg+= pos->key_parts;
295
296
  record= table_arg->getInsertRecord();
296
297
  recpos= 0;
297
298
  recinfo_pos= recinfo;
298
 
  while (recpos < (uint) share->stored_rec_length)
 
299
 
 
300
  while (recpos < (uint) share->sizeStoredRecord())
299
301
  {
300
302
    Field **field, *found= 0;
301
303
    minpos= share->getRecordLength();
309
311
        /* skip null fields */
310
312
        if (!(temp_length= (*field)->pack_length_in_rec()))
311
313
          continue; /* Skip null-fields */
 
314
 
312
315
        if (! found || fieldpos < minpos ||
313
316
            (fieldpos == minpos && temp_length < length))
314
317
        {
530
533
{
531
534
  Session *cur_session;
532
535
  if ((cur_session= file->in_use))
533
 
    errmsg_printf(ERRMSG_LVL_ERROR, _("Got an error from thread_id=%"PRIu64", %s:%d"),
 
536
  {
 
537
    errmsg_printf(error::ERROR, _("Got an error from thread_id=%"PRIu64", %s:%d"),
534
538
                    cur_session->thread_id,
535
539
                    sfile, sline);
 
540
  }
536
541
  else
537
 
    errmsg_printf(ERRMSG_LVL_ERROR, _("Got an error from unknown thread, %s:%d"), sfile, sline);
 
542
  {
 
543
    errmsg_printf(error::ERROR, _("Got an error from unknown thread, %s:%d"), sfile, sline);
 
544
  }
 
545
 
538
546
  if (message)
539
 
    errmsg_printf(ERRMSG_LVL_ERROR, "%s", message);
 
547
    errmsg_printf(error::ERROR, "%s", message);
 
548
 
540
549
  list<Session *>::iterator it= file->s->in_use->begin();
541
550
  while (it != file->s->in_use->end())
542
551
  {
543
 
    errmsg_printf(ERRMSG_LVL_ERROR, "%s", _("Unknown thread accessing table"));
 
552
    errmsg_printf(error::ERROR, "%s", _("Unknown thread accessing table"));
544
553
    ++it;
545
554
  }
546
555
}
567
576
}
568
577
 
569
578
/* Name is here without an extension */
570
 
int ha_myisam::doOpen(const drizzled::TableIdentifier &identifier, int mode, uint32_t test_if_locked)
 
579
int ha_myisam::doOpen(const drizzled::identifier::Table &identifier, int mode, uint32_t test_if_locked)
571
580
{
572
581
  MI_KEYDEF *keyinfo;
573
582
  MI_COLUMNDEF *recinfo= 0;
691
700
  */
692
701
  if (file->dfile == -1)
693
702
  {
694
 
    errmsg_printf(ERRMSG_LVL_INFO, "Retrying repair of: '%s' failed. "
695
 
                          "Please try REPAIR EXTENDED or myisamchk",
696
 
                          getTable()->getShare()->getPath());
 
703
    errmsg_printf(error::INFO, "Retrying repair of: '%s' failed. "
 
704
                  "Please try REPAIR EXTENDED or myisamchk",
 
705
                  getTable()->getShare()->getPath());
697
706
    return(HA_ADMIN_FAILED);
698
707
  }
699
708
 
918
927
    param.stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
919
928
    if ((error= (repair(session,param,0) != HA_ADMIN_OK)) && param.retry_repair)
920
929
    {
921
 
      errmsg_printf(ERRMSG_LVL_WARN, "Warning: Enabling keys got errno %d on %s.%s, retrying",
 
930
      errmsg_printf(error::WARN, "Warning: Enabling keys got errno %d on %s.%s, retrying",
922
931
                        errno, param.db_name, param.table_name);
923
932
      /* Repairing by sort failed. Now try standard repair method. */
924
933
      param.testflag&= ~(T_REP_BY_SORT | T_QUICK);
928
937
        might have been set by the first repair. They can still be seen
929
938
        with SHOW WARNINGS then.
930
939
      */
931
 
      if (! error)
 
940
      if (not error)
932
941
        session->clear_error();
933
942
    }
934
943
    info(HA_STATUS_CONST);
1329
1338
}
1330
1339
 
1331
1340
int MyisamEngine::doDropTable(Session &session,
1332
 
                              const TableIdentifier &identifier)
 
1341
                              const identifier::Table &identifier)
1333
1342
{
1334
1343
  session.getMessageCache().removeTableMessage(identifier);
1335
1344
 
1347
1356
 
1348
1357
int MyisamEngine::doCreateTable(Session &session,
1349
1358
                                Table& table_arg,
1350
 
                                const TableIdentifier &identifier,
 
1359
                                const identifier::Table &identifier,
1351
1360
                                message::Table& create_proto)
1352
1361
{
1353
1362
  int error;
1393
1402
}
1394
1403
 
1395
1404
 
1396
 
int MyisamEngine::doRenameTable(Session &session, const TableIdentifier &from, const TableIdentifier &to)
 
1405
int MyisamEngine::doRenameTable(Session &session, const identifier::Table &from, const identifier::Table &to)
1397
1406
{
1398
1407
  session.getMessageCache().renameTableMessage(from, to);
1399
1408
 
1504
1513
{
1505
1514
  context("max-sort-file-size",
1506
1515
          po::value<uint64_t>(&max_sort_file_size)->default_value(INT32_MAX),
1507
 
          N_("Don't use the fast sort index method to created index if the temporary file would get bigger than this."));
 
1516
          _("Don't use the fast sort index method to created index if the temporary file would get bigger than this."));
1508
1517
  context("sort-buffer-size",
1509
1518
          po::value<sort_buffer_constraint>(&sort_buffer_size)->default_value(8192*1024),
1510
 
          N_("The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE."));
 
1519
          _("The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE."));
1511
1520
}
1512
1521
 
1513
1522
 
1520
1529
  "Default engine as of MySQL 3.23 with great performance",
1521
1530
  PLUGIN_LICENSE_GPL,
1522
1531
  myisam_init, /* Plugin Init */
1523
 
  NULL,           /* system variables */
 
1532
  NULL,           /* depends */
1524
1533
  init_options                        /* config options                  */
1525
1534
}
1526
1535
DRIZZLE_DECLARE_PLUGIN_END;