~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field.cc

  • Committer: Brian Aker
  • Date: 2009-11-02 20:55:06 UTC
  • mfrom: (971.7.7 eday-dev)
  • Revision ID: brian@gaz-20091102205506-20y1mki0uft56jzy
MergeĀ Eric

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
static enum_field_types
55
55
field_types_merge_rules [DRIZZLE_TYPE_MAX+1][DRIZZLE_TYPE_MAX+1]=
56
56
{
57
 
  /* DRIZZLE_TYPE_TINY -> */
58
 
  {
59
 
    //DRIZZLE_TYPE_TINY
60
 
    DRIZZLE_TYPE_TINY,
61
 
    //DRIZZLE_TYPE_LONG
62
 
    DRIZZLE_TYPE_LONG,
63
 
    //DRIZZLE_TYPE_DOUBLE
64
 
    DRIZZLE_TYPE_DOUBLE,
65
 
    //DRIZZLE_TYPE_NULL
66
 
    DRIZZLE_TYPE_TINY,
67
 
    //DRIZZLE_TYPE_TIMESTAMP
68
 
    DRIZZLE_TYPE_VARCHAR,
69
 
    //DRIZZLE_TYPE_LONGLONG
70
 
    DRIZZLE_TYPE_LONGLONG,
71
 
    //DRIZZLE_TYPE_DATETIME
72
 
    DRIZZLE_TYPE_VARCHAR,
73
 
    //DRIZZLE_TYPE_DATE
74
 
    DRIZZLE_TYPE_VARCHAR,
75
 
    //DRIZZLE_TYPE_VARCHAR
76
 
    DRIZZLE_TYPE_VARCHAR,
77
 
    //DRIZZLE_TYPE_NEWDECIMAL
78
 
    DRIZZLE_TYPE_NEWDECIMAL,
79
 
    //DRIZZLE_TYPE_ENUM
80
 
    DRIZZLE_TYPE_VARCHAR,
81
 
    //DRIZZLE_TYPE_BLOB
82
 
    DRIZZLE_TYPE_BLOB,
83
 
  },
84
57
  /* DRIZZLE_TYPE_LONG -> */
85
58
  {
86
 
    //DRIZZLE_TYPE_TINY
87
 
    DRIZZLE_TYPE_LONG,
88
59
    //DRIZZLE_TYPE_LONG
89
60
    DRIZZLE_TYPE_LONG,
90
61
    //DRIZZLE_TYPE_DOUBLE
110
81
  },
111
82
  /* DRIZZLE_TYPE_DOUBLE -> */
112
83
  {
113
 
    //DRIZZLE_TYPE_TINY
114
 
    DRIZZLE_TYPE_DOUBLE,
115
84
    //DRIZZLE_TYPE_LONG
116
85
    DRIZZLE_TYPE_DOUBLE,
117
86
    //DRIZZLE_TYPE_DOUBLE
137
106
  },
138
107
  /* DRIZZLE_TYPE_NULL -> */
139
108
  {
140
 
    //DRIZZLE_TYPE_TINY
141
 
    DRIZZLE_TYPE_TINY,
142
109
    //DRIZZLE_TYPE_LONG
143
110
    DRIZZLE_TYPE_LONG,
144
111
    //DRIZZLE_TYPE_DOUBLE
164
131
  },
165
132
  /* DRIZZLE_TYPE_TIMESTAMP -> */
166
133
  {
167
 
    //DRIZZLE_TYPE_TINY
168
 
    DRIZZLE_TYPE_VARCHAR,
169
134
    //DRIZZLE_TYPE_LONG
170
135
    DRIZZLE_TYPE_VARCHAR,
171
136
    //DRIZZLE_TYPE_DOUBLE
191
156
  },
192
157
  /* DRIZZLE_TYPE_LONGLONG -> */
193
158
  {
194
 
    //DRIZZLE_TYPE_TINY
195
 
    DRIZZLE_TYPE_LONGLONG,
196
159
    //DRIZZLE_TYPE_LONG
197
160
    DRIZZLE_TYPE_LONGLONG,
198
161
    //DRIZZLE_TYPE_DOUBLE
217
180
  },
218
181
  /* DRIZZLE_TYPE_DATETIME -> */
219
182
  {
220
 
    //DRIZZLE_TYPE_TINY
221
 
    DRIZZLE_TYPE_VARCHAR,
222
183
    //DRIZZLE_TYPE_LONG
223
184
    DRIZZLE_TYPE_VARCHAR,
224
185
    //DRIZZLE_TYPE_DOUBLE
244
205
  },
245
206
  /* DRIZZLE_TYPE_DATE -> */
246
207
  {
247
 
    //DRIZZLE_TYPE_TINY
248
 
    DRIZZLE_TYPE_VARCHAR,
249
208
    //DRIZZLE_TYPE_LONG
250
209
    DRIZZLE_TYPE_VARCHAR,
251
210
    //DRIZZLE_TYPE_DOUBLE
271
230
  },
272
231
  /* DRIZZLE_TYPE_VARCHAR -> */
273
232
  {
274
 
    //DRIZZLE_TYPE_TINY
275
 
    DRIZZLE_TYPE_VARCHAR,
276
233
    //DRIZZLE_TYPE_LONG
277
234
    DRIZZLE_TYPE_VARCHAR,
278
235
    //DRIZZLE_TYPE_DOUBLE
298
255
  },
299
256
  /* DRIZZLE_TYPE_NEWDECIMAL -> */
300
257
  {
301
 
    //DRIZZLE_TYPE_TINY
302
 
    DRIZZLE_TYPE_NEWDECIMAL,
303
258
    //DRIZZLE_TYPE_LONG
304
259
    DRIZZLE_TYPE_NEWDECIMAL,
305
260
    //DRIZZLE_TYPE_DOUBLE
325
280
  },
326
281
  /* DRIZZLE_TYPE_ENUM -> */
327
282
  {
328
 
    //DRIZZLE_TYPE_TINY
329
 
    DRIZZLE_TYPE_VARCHAR,
330
283
    //DRIZZLE_TYPE_LONG
331
284
    DRIZZLE_TYPE_VARCHAR,
332
285
    //DRIZZLE_TYPE_DOUBLE
352
305
  },
353
306
  /* DRIZZLE_TYPE_BLOB -> */
354
307
  {
355
 
    //DRIZZLE_TYPE_TINY
356
 
    DRIZZLE_TYPE_BLOB,
357
308
    //DRIZZLE_TYPE_LONG
358
309
    DRIZZLE_TYPE_BLOB,
359
310
    //DRIZZLE_TYPE_DOUBLE
381
332
 
382
333
static Item_result field_types_result_type [DRIZZLE_TYPE_MAX+1]=
383
334
{
384
 
  //DRIZZLE_TYPE_TINY
385
 
  INT_RESULT,
386
335
  //DRIZZLE_TYPE_LONG
387
336
  INT_RESULT,
388
337
  //DRIZZLE_TYPE_DOUBLE
986
935
{
987
936
  switch (type) {
988
937
  case DRIZZLE_TYPE_VARCHAR: return (length + (length < 256 ? 1: 2));
989
 
  case DRIZZLE_TYPE_TINY: return 1;
990
938
  case DRIZZLE_TYPE_DATE: return 3;
991
939
  case DRIZZLE_TYPE_TIMESTAMP:
992
940
  case DRIZZLE_TYPE_LONG: return 4;
1109
1057
                                   decimals,
1110
1058
                                   false,
1111
1059
                                   false /* is_unsigned */);
1112
 
  case DRIZZLE_TYPE_TINY:
1113
 
    assert(0);
1114
1060
  case DRIZZLE_TYPE_LONG:
1115
1061
    return new (root) Field_long(ptr,
1116
1062
                                 field_length,