~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/definition/table.cc

  • Committer: Brian Aker
  • Date: 2010-10-29 04:00:23 UTC
  • mto: (1890.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1891.
  • Revision ID: brian@tangent.org-20101029040023-q1j7yeq6n52oarn1
Additional C++ warning fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; i/dent-tabs-mode: nil; -*-
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
4
 *  Copyright (C) 2010 Brian Aker
70
70
#include "drizzled/field/decimal.h"
71
71
#include "drizzled/field/real.h"
72
72
#include "drizzled/field/double.h"
73
 
#include "drizzled/field/int32.h"
74
 
#include "drizzled/field/int64.h"
 
73
#include "drizzled/field/long.h"
 
74
#include "drizzled/field/int64_t.h"
75
75
#include "drizzled/field/num.h"
76
76
#include "drizzled/field/timestamp.h"
77
77
#include "drizzled/field/datetime.h"
78
78
#include "drizzled/field/varstring.h"
79
 
#include "drizzled/field/uuid.h"
80
 
 
81
 
#include "drizzled/definition/cache.h"
82
79
 
83
80
using namespace std;
84
81
 
106
103
void TableShare::release(TableShare *share)
107
104
{
108
105
  bool to_be_deleted= false;
109
 
  safe_mutex_assert_owner(table::Cache::singleton().mutex().native_handle);
 
106
  safe_mutex_assert_owner(LOCK_open.native_handle);
110
107
 
111
108
  share->lock();
112
109
  if (!--share->ref_count)
113
110
  {
114
111
    to_be_deleted= true;
115
112
  }
 
113
 
 
114
  if (to_be_deleted)
 
115
  {
 
116
    TableIdentifier identifier(share->getSchemaName(), share->getTableName());
 
117
    plugin::EventObserver::deregisterTableEvents(*share);
 
118
   
 
119
    definition::Cache::singleton().erase(identifier);
 
120
    return;
 
121
  }
116
122
  share->unlock();
117
 
 
118
 
  if (to_be_deleted)
119
 
  {
120
 
    definition::Cache::singleton().erase(share->getCacheKey());
121
 
  }
122
123
}
123
124
 
124
 
void TableShare::release(TableShare::shared_ptr &share)
 
125
void TableShare::release(TableSharePtr &share)
125
126
{
126
127
  bool to_be_deleted= false;
127
 
  safe_mutex_assert_owner(table::Cache::singleton().mutex().native_handle);
 
128
  safe_mutex_assert_owner(LOCK_open.native_handle);
128
129
 
129
130
  share->lock();
130
131
  if (!--share->ref_count)
131
132
  {
132
133
    to_be_deleted= true;
133
134
  }
 
135
 
 
136
  if (to_be_deleted)
 
137
  {
 
138
    TableIdentifier identifier(share->getSchemaName(), share->getTableName());
 
139
    plugin::EventObserver::deregisterTableEvents(*share);
 
140
   
 
141
    definition::Cache::singleton().erase(identifier);
 
142
    return;
 
143
  }
134
144
  share->unlock();
135
 
 
136
 
  if (to_be_deleted)
137
 
  {
138
 
    definition::Cache::singleton().erase(share->getCacheKey());
139
 
  }
140
145
}
141
146
 
142
 
void TableShare::release(const TableIdentifier &identifier)
 
147
void TableShare::release(TableIdentifier &identifier)
143
148
{
144
 
  TableShare::shared_ptr share= definition::Cache::singleton().find(identifier.getKey());
 
149
  TableSharePtr share= definition::Cache::singleton().find(identifier);
145
150
  if (share)
146
151
  {
147
152
    share->version= 0;                          // Mark for delete
148
153
    if (share->ref_count == 0)
149
154
    {
150
 
      definition::Cache::singleton().erase(identifier.getKey());
 
155
      share->lock();
 
156
      plugin::EventObserver::deregisterTableEvents(*share);
 
157
      definition::Cache::singleton().erase(identifier);
151
158
    }
152
159
  }
153
160
}
154
161
 
155
162
 
156
 
static TableShare::shared_ptr foundTableShare(TableShare::shared_ptr share)
 
163
static TableSharePtr foundTableShare(TableSharePtr share)
157
164
{
158
165
  /*
159
166
    We found an existing table definition. Return it if we didn't get
166
173
    /* Table definition contained an error */
167
174
    share->open_table_error(share->error, share->open_errno, share->errarg);
168
175
 
169
 
    return TableShare::shared_ptr();
 
176
    return TableSharePtr();
170
177
  }
171
178
 
172
179
  share->incrementTableCount();
189
196
  If it doesn't exist, create a new from the table definition file.
190
197
 
191
198
  NOTES
192
 
  We must have wrlock on table::Cache::singleton().mutex() when we come here
 
199
  We must have wrlock on LOCK_open when we come here
193
200
  (To be changed later)
194
201
 
195
202
  RETURN
197
204
#  Share for table
198
205
*/
199
206
 
200
 
TableShare::shared_ptr TableShare::getShareCreate(Session *session, 
201
 
                                                  const TableIdentifier &identifier,
202
 
                                                  int &in_error)
 
207
TableSharePtr TableShare::getShareCreate(Session *session, 
 
208
                                         TableIdentifier &identifier,
 
209
                                         int *error)
203
210
{
204
 
  TableShare::shared_ptr share;
 
211
  TableSharePtr share;
205
212
 
206
 
  in_error= 0;
 
213
  *error= 0;
207
214
 
208
215
  /* Read table definition from cache */
209
 
  if ((share= definition::Cache::singleton().find(identifier.getKey())))
 
216
  if ((share= definition::Cache::singleton().find(identifier)))
210
217
    return foundTableShare(share);
211
218
 
212
219
  share.reset(new TableShare(message::Table::STANDARD, identifier));
213
220
  
 
221
  /*
 
222
    Lock mutex to be able to read table definition from file without
 
223
    conflicts
 
224
  */
 
225
  share->lock();
 
226
 
 
227
  bool ret= definition::Cache::singleton().insert(identifier, share);
 
228
 
 
229
  if (not ret)
 
230
    return TableSharePtr();
 
231
 
214
232
  if (share->open_table_def(*session, identifier))
215
233
  {
216
 
    in_error= share->error;
 
234
    *error= share->error;
 
235
    definition::Cache::singleton().erase(identifier);
217
236
 
218
 
    return TableShare::shared_ptr();
 
237
    return TableSharePtr();
219
238
  }
220
239
  share->ref_count++;                           // Mark in use
221
240
  
222
241
  plugin::EventObserver::registerTableEvents(*share);
223
 
 
224
 
  bool ret= definition::Cache::singleton().insert(identifier.getKey(), share);
225
 
 
226
 
  if (not ret)
227
 
    return TableShare::shared_ptr();
 
242
  
 
243
  share->unlock();
228
244
 
229
245
  return share;
230
246
}
231
247
 
 
248
 
 
249
/*
 
250
  Check if table definition exits in cache
 
251
 
 
252
  SYNOPSIS
 
253
  get_cached_table_share()
 
254
  db                    Database name
 
255
  table_name            Table name
 
256
 
 
257
  RETURN
 
258
  0  Not cached
 
259
#  TableShare for table
 
260
*/
 
261
TableSharePtr TableShare::getShare(TableIdentifier &identifier)
 
262
{
 
263
  safe_mutex_assert_owner(LOCK_open.native_handle);
 
264
 
 
265
  return definition::Cache::singleton().find(identifier);
 
266
}
 
267
 
232
268
static enum_field_types proto_field_type_to_drizzle_type(uint32_t proto_field_type)
233
269
{
234
270
  enum_field_types field_type;
265
301
  case message::Table::Field::BLOB:
266
302
    field_type= DRIZZLE_TYPE_BLOB;
267
303
    break;
268
 
  case message::Table::Field::UUID:
269
 
    field_type= DRIZZLE_TYPE_UUID;
270
 
    break;
271
304
  default:
272
 
    assert(0);
273
 
    abort(); // Programming error
 
305
    field_type= DRIZZLE_TYPE_LONG; /* Set value to kill GCC warning */
 
306
    assert(1);
274
307
  }
275
308
 
276
309
  return field_type;
304
337
                                 default_value->length());
305
338
    break;
306
339
  case DRIZZLE_TYPE_NULL:
307
 
    assert(0);
308
 
    abort();
 
340
    assert(false);
309
341
  case DRIZZLE_TYPE_TIMESTAMP:
310
342
  case DRIZZLE_TYPE_DATETIME:
311
343
  case DRIZZLE_TYPE_DATE:
312
344
  case DRIZZLE_TYPE_ENUM:
313
 
  case DRIZZLE_TYPE_UUID:
314
345
    default_item= new Item_string(default_value->c_str(),
315
346
                                  default_value->length(),
316
347
                                  system_charset_info);
361
392
      size_t num_parts= index.index_part_size();
362
393
      for (size_t y= 0; y < num_parts; ++y)
363
394
      {
364
 
        if (index.index_part(y).fieldnr() == in_field->position())
 
395
        if (index.index_part(y).fieldnr() == in_field->field_index)
365
396
          return true;
366
397
      }
367
398
    }
369
400
  return false;
370
401
}
371
402
 
372
 
TableShare::TableShare(const TableIdentifier::Type type_arg) :
 
403
TableShare::TableShare(TableIdentifier::Type type_arg) :
373
404
  table_category(TABLE_UNKNOWN_CATEGORY),
374
405
  found_next_number_field(NULL),
375
406
  timestamp_field(NULL),
398
429
  uniques(0),
399
430
  null_fields(0),
400
431
  blob_fields(0),
 
432
  timestamp_field_offset(0),
401
433
  has_variable_width(false),
402
434
  db_create_options(0),
403
435
  db_options_in_use(0),
412
444
  errarg(0),
413
445
  blob_ptr_size(0),
414
446
  db_low_byte_first(false),
 
447
  name_lock(false),
 
448
  replace_with_name_lock(false),
 
449
  waiting_on_cond(false),
415
450
  keys_in_use(0),
416
451
  keys_for_keyread(0),
417
452
  event_observers(NULL)
434
469
  }
435
470
}
436
471
 
437
 
TableShare::TableShare(const TableIdentifier &identifier, const TableIdentifier::Key &key) :// Used by placeholder
 
472
TableShare::TableShare(TableIdentifier &identifier, const TableIdentifier::Key &key) :// Used by placeholder
438
473
  table_category(TABLE_UNKNOWN_CATEGORY),
439
474
  found_next_number_field(NULL),
440
475
  timestamp_field(NULL),
463
498
  uniques(0),
464
499
  null_fields(0),
465
500
  blob_fields(0),
 
501
  timestamp_field_offset(0),
466
502
  has_variable_width(false),
467
503
  db_create_options(0),
468
504
  db_options_in_use(0),
477
513
  errarg(0),
478
514
  blob_ptr_size(0),
479
515
  db_low_byte_first(false),
 
516
  name_lock(false),
 
517
  replace_with_name_lock(false),
 
518
  waiting_on_cond(false),
480
519
  keys_in_use(0),
481
520
  keys_for_keyread(0),
482
521
  event_observers(NULL)
500
539
  path.str= (char *)"";
501
540
  normalized_path.str= path.str;
502
541
  path.length= normalized_path.length= 0;
503
 
 
504
 
  std::string tb_name(identifier.getTableName());
505
 
  std::transform(tb_name.begin(), tb_name.end(), tb_name.begin(), ::tolower);
506
 
  assert(strcmp(tb_name.c_str(), table_name.str) == 0);
507
 
 
 
542
  assert(strcmp(identifier.getTableName().c_str(), table_name.str) == 0);
508
543
  assert(strcmp(identifier.getSchemaName().c_str(), db.str) == 0);
509
544
}
510
545
 
538
573
  uniques(0),
539
574
  null_fields(0),
540
575
  blob_fields(0),
 
576
  timestamp_field_offset(0),
541
577
  has_variable_width(false),
542
578
  db_create_options(0),
543
579
  db_options_in_use(0),
552
588
  errarg(0),
553
589
  blob_ptr_size(0),
554
590
  db_low_byte_first(false),
 
591
  name_lock(false),
 
592
  replace_with_name_lock(false),
 
593
  waiting_on_cond(false),
555
594
  keys_in_use(0),
556
595
  keys_for_keyread(0),
557
596
  event_observers(NULL)
584
623
/*
585
624
  Used for shares that will go into the cache.
586
625
*/
587
 
TableShare::TableShare(const TableIdentifier::Type type_arg,
588
 
                       const TableIdentifier &identifier,
 
626
TableShare::TableShare(TableIdentifier::Type type_arg,
 
627
                       TableIdentifier &identifier,
589
628
                       char *path_arg,
590
629
                       uint32_t path_length_arg) :
591
630
  table_category(TABLE_UNKNOWN_CATEGORY),
616
655
  uniques(0),
617
656
  null_fields(0),
618
657
  blob_fields(0),
 
658
  timestamp_field_offset(0),
619
659
  has_variable_width(false),
620
660
  db_create_options(0),
621
661
  db_options_in_use(0),
630
670
  errarg(0),
631
671
  blob_ptr_size(0),
632
672
  db_low_byte_first(false),
 
673
  name_lock(false),
 
674
  replace_with_name_lock(false),
 
675
  waiting_on_cond(false),
633
676
  keys_in_use(0),
634
677
  keys_for_keyread(0),
635
678
  event_observers(NULL)
673
716
  else
674
717
  {
675
718
    assert(0); // We should throw here.
676
 
    abort();
677
719
  }
678
720
}
679
721
 
696
738
{
697
739
  assert(ref_count == 0);
698
740
 
 
741
  /*
 
742
    If someone is waiting for this to be deleted, inform it about this.
 
743
    Don't do a delete until we know that no one is refering to this anymore.
 
744
  */
 
745
  if (tmp_table == message::Table::STANDARD)
 
746
  {
 
747
    /* share->mutex is locked in release_table_share() */
 
748
    while (waiting_on_cond)
 
749
    {
 
750
      cond.notify_all();
 
751
      boost::mutex::scoped_lock scoped(mutex, boost::adopt_lock_t());
 
752
      cond.wait(scoped);
 
753
      scoped.release();
 
754
    }
 
755
    /* No thread refers to this anymore */
 
756
    mutex.unlock();
 
757
  }
 
758
 
699
759
  storage_engine= NULL;
700
760
 
701
761
  delete table_proto;
702
762
  table_proto= NULL;
703
763
 
704
 
  plugin::EventObserver::deregisterTableEvents(*this);
705
 
 
706
764
  mem_root.free_root(MYF(0));                 // Free's share
707
765
}
708
766
 
709
 
void TableShare::setIdentifier(const TableIdentifier &identifier_arg)
 
767
void TableShare::setIdentifier(TableIdentifier &identifier_arg)
710
768
{
711
769
  private_key_for_cache= identifier_arg.getKey();
712
770
 
934
992
  uint32_t local_null_fields= 0;
935
993
  reclength= 0;
936
994
 
937
 
  std::vector<uint32_t> field_offsets;
938
 
  std::vector<uint32_t> field_pack_length;
 
995
  vector<uint32_t> field_offsets;
 
996
  vector<uint32_t> field_pack_length;
939
997
 
940
998
  field_offsets.resize(fields);
941
999
  field_pack_length.resize(fields);
1135
1193
        unireg_type= Field::TIMESTAMP_DN_FIELD;
1136
1194
      }
1137
1195
      else
1138
 
      {
1139
 
        assert(0); // Invalid update value.
1140
 
        abort();
1141
 
      }
 
1196
        assert(1); // Invalid update value.
1142
1197
    }
1143
1198
    else if (pfield.has_options() &&
1144
1199
             pfield.options().has_update_expression() &&
1231
1286
    }
1232
1287
 
1233
1288
 
 
1289
    db_low_byte_first= true; //Cursor->low_byte_first();
1234
1290
    blob_ptr_size= portable_sizeof_char_ptr;
1235
1291
 
1236
1292
    uint32_t field_length= 0; //Assignment is for compiler complaint.
1315
1371
    case DRIZZLE_TYPE_LONGLONG:
1316
1372
      field_length= MAX_BIGINT_WIDTH;
1317
1373
      break;
1318
 
    case DRIZZLE_TYPE_UUID:
1319
 
      field_length= field::Uuid::max_string_length();
1320
 
      break;
1321
1374
    case DRIZZLE_TYPE_NULL:
1322
1375
      abort(); // Programming error
1323
1376
    }
1324
1377
 
1325
 
    assert(enum_field_types_size == 12);
1326
 
 
1327
1378
    Field* f= make_field(record + field_offsets[fieldnr] + data_offset,
1328
 
                         field_length,
1329
 
                         pfield.constraints().is_nullable(),
1330
 
                         null_pos,
1331
 
                         null_bit_pos,
1332
 
                         decimals,
1333
 
                         field_type,
1334
 
                         charset,
1335
 
                         MTYP_TYPENR(unireg_type),
1336
 
                         ((field_type == DRIZZLE_TYPE_ENUM) ?  &intervals[interval_nr++] : (TYPELIB*) 0),
1337
 
                         getTableProto()->field(fieldnr).name().c_str());
 
1379
                                field_length,
 
1380
                                pfield.constraints().is_nullable(),
 
1381
                                null_pos,
 
1382
                                null_bit_pos,
 
1383
                                decimals,
 
1384
                                field_type,
 
1385
                                charset,
 
1386
                                (Field::utype) MTYP_TYPENR(unireg_type),
 
1387
                                ((field_type == DRIZZLE_TYPE_ENUM) ?
 
1388
                                 &intervals[interval_nr++]
 
1389
                                 : (TYPELIB*) 0),
 
1390
                                getTableProto()->field(fieldnr).name().c_str());
1338
1391
 
1339
1392
    field[fieldnr]= f;
1340
1393
 
1341
 
    // Insert post make_field code here.
1342
 
    switch (field_type)
1343
 
    {
1344
 
    case DRIZZLE_TYPE_BLOB:
1345
 
    case DRIZZLE_TYPE_VARCHAR:
1346
 
    case DRIZZLE_TYPE_DOUBLE:
1347
 
    case DRIZZLE_TYPE_DECIMAL:
1348
 
    case DRIZZLE_TYPE_TIMESTAMP:
1349
 
    case DRIZZLE_TYPE_DATETIME:
1350
 
    case DRIZZLE_TYPE_DATE:
1351
 
    case DRIZZLE_TYPE_ENUM:
1352
 
    case DRIZZLE_TYPE_LONG:
1353
 
    case DRIZZLE_TYPE_LONGLONG:
1354
 
    case DRIZZLE_TYPE_NULL:
1355
 
    case DRIZZLE_TYPE_UUID:
1356
 
      break;
1357
 
    }
1358
 
 
1359
1394
    // This needs to go, we should be setting the "use" on the field so that
1360
1395
    // it does not reference the share/table.
1361
1396
    table::Shell temp_table(*this); /* Use this so that BLOB DEFAULT '' works */
1385
1420
        return local_error;
1386
1421
      }
1387
1422
    }
1388
 
    else if (f->real_type() == DRIZZLE_TYPE_ENUM && (f->flags & NOT_NULL_FLAG))
 
1423
    else if (f->real_type() == DRIZZLE_TYPE_ENUM &&
 
1424
             (f->flags & NOT_NULL_FLAG))
1389
1425
    {
1390
1426
      f->set_notnull();
1391
1427
      f->store((int64_t) 1, true);
1399
1435
    f->setTable(NULL);
1400
1436
    f->orig_table= NULL;
1401
1437
 
1402
 
    f->setPosition(fieldnr);
 
1438
    f->field_index= fieldnr;
1403
1439
    f->comment= comment;
1404
1440
    if (! default_value &&
1405
1441
        ! (f->unireg_check==Field::NEXT_NUMBER) &&
1412
1448
    if (f->unireg_check == Field::NEXT_NUMBER)
1413
1449
      found_next_number_field= &(field[fieldnr]);
1414
1450
 
 
1451
    if (timestamp_field == f)
 
1452
      timestamp_field_offset= fieldnr;
 
1453
 
1415
1454
    if (use_hash) /* supposedly this never fails... but comments lie */
1416
1455
    {
1417
1456
      const char *local_field_name= field[fieldnr]->field_name;
1418
1457
      name_hash.insert(make_pair(local_field_name, &(field[fieldnr])));
1419
1458
    }
 
1459
 
1420
1460
  }
1421
1461
 
1422
1462
  keyinfo= key_info;
1441
1481
    We need to set the unused bits to 1. If the number of bits is a multiple
1442
1482
    of 8 there are no unused bits.
1443
1483
  */
 
1484
 
1444
1485
  if (null_count & 7)
1445
1486
    *(record + null_count / 8)|= ~(((unsigned char) 1 << (null_count & 7)) - 1);
1446
1487
 
1617
1658
    }
1618
1659
  }
1619
1660
 
 
1661
  db_low_byte_first= true; // @todo Question this.
1620
1662
  all_set.clear();
1621
1663
  all_set.resize(fields);
1622
1664
  all_set.set();
1664
1706
  6    Unknown .frm version
1665
1707
*/
1666
1708
 
1667
 
int TableShare::open_table_def(Session& session, const TableIdentifier &identifier)
 
1709
int TableShare::open_table_def(Session& session, TableIdentifier &identifier)
1668
1710
{
1669
1711
  int local_error;
1670
1712
  bool error_given;
1672
1714
  local_error= 1;
1673
1715
  error_given= 0;
1674
1716
 
1675
 
  message::table::shared_ptr table;
 
1717
  message::Table table;
1676
1718
 
1677
1719
  local_error= plugin::StorageEngine::getTableDefinition(session, identifier, table);
1678
1720
 
1685
1727
    }
1686
1728
    else
1687
1729
    {
1688
 
      if (not table->IsInitialized())
 
1730
      if (not table.IsInitialized())
1689
1731
      {
1690
1732
        local_error= 4;
1691
1733
      }
1693
1735
    goto err_not_open;
1694
1736
  }
1695
1737
 
1696
 
  local_error= parse_table_proto(session, *table);
 
1738
  local_error= parse_table_proto(session, table);
1697
1739
 
1698
1740
  setTableCategory(TABLE_CATEGORY_USER);
1699
1741
 
1845
1887
    outparam.found_next_number_field=
1846
1888
      outparam.getField(positionFields(found_next_number_field));
1847
1889
  if (timestamp_field)
1848
 
    outparam.timestamp_field= (Field_timestamp*) outparam.getField(timestamp_field->position());
 
1890
    outparam.timestamp_field= (Field_timestamp*) outparam.getField(timestamp_field_offset);
 
1891
 
1849
1892
 
1850
1893
  /* Fix key->name and key_part->field */
1851
1894
  if (key_parts)
2037
2080
  case DRIZZLE_TYPE_DATE:
2038
2081
  case DRIZZLE_TYPE_DATETIME:
2039
2082
  case DRIZZLE_TYPE_TIMESTAMP:
2040
 
  case DRIZZLE_TYPE_UUID:
2041
2083
    field_charset= &my_charset_bin;
2042
2084
  default: break;
2043
2085
  }
2055
2097
  case DRIZZLE_TYPE_VARCHAR:
2056
2098
    setVariableWidth();
2057
2099
    return new (&mem_root) Field_varstring(ptr,field_length,
2058
 
                                      ha_varchar_packlength(field_length),
 
2100
                                      HA_VARCHAR_PACKLENGTH(field_length),
2059
2101
                                      null_pos,null_bit,
2060
2102
                                      field_name,
2061
2103
                                      field_charset);
2065
2107
                                 null_bit,
2066
2108
                                 field_name,
2067
2109
                                 this,
 
2110
                                 calc_pack_length(DRIZZLE_TYPE_LONG, 0),
2068
2111
                                 field_charset);
2069
2112
  case DRIZZLE_TYPE_DECIMAL:
2070
2113
    return new (&mem_root) Field_decimal(ptr,
2086
2129
                                   decimals,
2087
2130
                                   false,
2088
2131
                                   false /* is_unsigned */);
2089
 
  case DRIZZLE_TYPE_UUID:
2090
 
    return new (&mem_root) field::Uuid(ptr,
2091
 
                                       field_length,
2092
 
                                       null_pos,
2093
 
                                       null_bit,
2094
 
                                       field_name);
2095
2132
  case DRIZZLE_TYPE_LONG:
2096
 
    return new (&mem_root) field::Int32(ptr,
2097
 
                                        field_length,
2098
 
                                        null_pos,
2099
 
                                        null_bit,
2100
 
                                        unireg_check,
2101
 
                                        field_name);
 
2133
    return new (&mem_root) Field_long(ptr,
 
2134
                                 field_length,
 
2135
                                 null_pos,
 
2136
                                 null_bit,
 
2137
                                 unireg_check,
 
2138
                                 field_name,
 
2139
                                 false,
 
2140
                                 false /* is_unsigned */);
2102
2141
  case DRIZZLE_TYPE_LONGLONG:
2103
 
    return new (&mem_root) field::Int64(ptr,
2104
 
                                        field_length,
2105
 
                                        null_pos,
2106
 
                                        null_bit,
2107
 
                                        unireg_check,
2108
 
                                        field_name);
 
2142
    return new (&mem_root) Field_int64_t(ptr,
 
2143
                                    field_length,
 
2144
                                    null_pos,
 
2145
                                    null_bit,
 
2146
                                    unireg_check,
 
2147
                                    field_name,
 
2148
                                    false,
 
2149
                                    false /* is_unsigned */);
2109
2150
  case DRIZZLE_TYPE_TIMESTAMP:
2110
2151
    return new (&mem_root) Field_timestamp(ptr,
2111
2152
                                      field_length,
2132
2173
                                 field_length,
2133
2174
                                 field_name,
2134
2175
                                 field_charset);
 
2176
  default: // Impossible (Wrong version)
 
2177
    break;
2135
2178
  }
2136
 
  assert(0);
2137
 
  abort();
 
2179
  return 0;
2138
2180
}
2139
2181
 
2140
2182