~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/create_field.cc

  • Committer: Brian Aker
  • Date: 2010-12-20 19:20:57 UTC
  • mto: This revision was merged to the branch mainline in revision 2016.
  • Revision ID: brian@tangent.org-20101220192057-1ch4b9uo008d8rje
Merge in additional fixes for sign, plus alter table, plus TIME on
processlist.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
#include "drizzled/field/decimal.h"
38
38
#include "drizzled/field/real.h"
39
39
#include "drizzled/field/double.h"
40
 
#include "drizzled/field/long.h"
41
 
#include "drizzled/field/int64_t.h"
 
40
#include "drizzled/field/int32.h"
 
41
#include "drizzled/field/int64.h"
42
42
#include "drizzled/field/num.h"
43
43
#include "drizzled/field/timestamp.h"
44
44
#include "drizzled/field/datetime.h"
45
45
#include "drizzled/field/varstring.h"
 
46
#include "drizzled/field/uuid.h"
46
47
#include "drizzled/temporal.h"
47
48
#include "drizzled/item/string.h"
48
49
 
 
50
#include "drizzled/display.h"
 
51
 
49
52
#include <algorithm>
50
53
 
51
54
using namespace std;
111
114
    {
112
115
      char buff[MAX_FIELD_WIDTH], *pos;
113
116
      String tmp(buff, sizeof(buff), charset), *res;
114
 
      res= orig_field->val_str(&tmp);
 
117
      res= orig_field->val_str_internal(&tmp);
115
118
      pos= (char*) memory::sql_strmake(res->ptr(), res->length());
116
119
      def= new Item_string(pos, res->length(), charset);
117
120
    }
350
353
    case DRIZZLE_TYPE_DATE:
351
354
      length= Date::MAX_STRING_LENGTH;
352
355
      break;
 
356
    case DRIZZLE_TYPE_UUID:
 
357
      length= field::Uuid::max_string_length();
 
358
      break;
353
359
    case DRIZZLE_TYPE_DATETIME:
354
360
      length= DateTime::MAX_STRING_LENGTH;
355
361
      break;
390
396
  return false; /* success */
391
397
}
392
398
 
 
399
std::ostream& operator<<(std::ostream& output, const CreateField &field)
 
400
{
 
401
  output << "CreateField:(";
 
402
  output <<  field.field_name;
 
403
  output << ", ";
 
404
  output << drizzled::display::type(field.type());
 
405
  output << ", { ";
 
406
 
 
407
  if (field.flags & NOT_NULL_FLAG)
 
408
    output << " NOT_NULL";
 
409
 
 
410
  if (field.flags & PRI_KEY_FLAG)
 
411
    output << ", PRIMARY KEY";
 
412
 
 
413
  if (field.flags & UNIQUE_KEY_FLAG)
 
414
    output << ", UNIQUE KEY";
 
415
 
 
416
  if (field.flags & MULTIPLE_KEY_FLAG)
 
417
    output << ", MULTIPLE KEY";
 
418
 
 
419
  if (field.flags & BLOB_FLAG)
 
420
    output << ", BLOB";
 
421
 
 
422
  if (field.flags & UNSIGNED_FLAG)
 
423
    output << ", UNSIGNED";
 
424
 
 
425
  if (field.flags & BINARY_FLAG)
 
426
    output << ", BINARY";
 
427
  output << "}, ";
 
428
  if (field.field)
 
429
    output << *field.field;
 
430
  output << ")";
 
431
 
 
432
  return output;  // for multiple << operators.
 
433
}
 
434
 
393
435
} /* namespace drizzled */