~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/unireg.cc

Giant merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
*/
25
25
 
26
26
#include "mysql_priv.h"
27
 
#include <m_ctype.h>
28
27
#include <assert.h>
29
28
 
30
29
#define FCOMP                   17              /* Bytes for a packed field */
258
257
    goto err;
259
258
 
260
259
  {
261
 
    bzero((uchar*) buff, 6);
 
260
    memset((uchar*) buff, 0, 6);
262
261
    if (my_write(file, (uchar*) buff, 6, MYF_RW))
263
262
      goto err;
264
263
  }
279
278
    {
280
279
      uint flags= 0;
281
280
 
282
 
      bzero(buff, format_section_header_size);
 
281
      memset(buff, 0, format_section_header_size);
283
282
      /* length of section 2 bytes*/
284
283
      int2store(buff+0, format_section_len);
285
284
      /* flags of section 4 bytes*/
561
560
/* Make formheader */
562
561
 
563
562
static bool pack_header(uchar *forminfo,
564
 
                        enum legacy_db_type table_type __attribute__((__unused__)),
 
563
                        enum legacy_db_type table_type __attribute__((unused)),
565
564
                        List<Create_field> &create_fields,
566
565
                        uint info_length, uint screens, uint table_options,
567
566
                        ulong data_offset, handler *file)
616
615
      We mark first TIMESTAMP field with NOW() in DEFAULT or ON UPDATE 
617
616
      as auto-update field.
618
617
    */
619
 
    if (field->sql_type == MYSQL_TYPE_TIMESTAMP &&
 
618
    if (field->sql_type == DRIZZLE_TYPE_TIMESTAMP &&
620
619
        MTYP_TYPENR(field->unireg_check) != Field::NONE &&
621
620
        !time_stamp_pos)
622
621
      time_stamp_pos= (uint) field->offset+ (uint) data_offset + 1;
695
694
    return(1);
696
695
  }
697
696
 
698
 
  bzero((char*)forminfo,288);
 
697
  memset((char*)forminfo, 0, 288);
699
698
  length=(info_length+create_fields.elements*FCOMP+288+n_length+int_length+
700
699
          com_length);
701
700
  int2store(forminfo,length);
821
820
        uint           i;
822
821
        unsigned char *val= NULL;
823
822
 
824
 
        bzero(occ, sizeof(occ));
 
823
        memset(occ, 0, sizeof(occ));
825
824
 
826
825
        for (i=0; (val= (unsigned char*) field->interval->type_names[i]); i++)
827
826
          for (uint j = 0; j < field->interval->type_lengths[i]; j++)
882
881
/* save an empty record on start of formfile */
883
882
 
884
883
static bool make_empty_rec(THD *thd, File file,
885
 
                           enum legacy_db_type table_type __attribute__((__unused__)),
 
884
                           enum legacy_db_type table_type __attribute__((unused)),
886
885
                           uint table_options,
887
886
                           List<Create_field> &create_fields,
888
887
                           uint reclength,
900
899
  
901
900
 
902
901
  /* We need a table to generate columns for default values */
903
 
  bzero((char*) &table, sizeof(table));
904
 
  bzero((char*) &share, sizeof(share));
 
902
  memset((char*) &table, 0, sizeof(table));
 
903
  memset((char*) &share, 0, sizeof(share));
905
904
  table.s= &share;
906
905
 
907
906
  if (!(buff=(uchar*) my_malloc((size_t) reclength,MYF(MY_WME | MY_ZEROFILL))))
969
968
        goto err;
970
969
      }
971
970
    }
972
 
    else if (regfield->real_type() == MYSQL_TYPE_ENUM &&
 
971
    else if (regfield->real_type() == DRIZZLE_TYPE_ENUM &&
973
972
             (field->flags & NOT_NULL_FLAG))
974
973
    {
975
974
      regfield->set_notnull();