~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/unireg.cc

  • Committer: Stewart Smith
  • Date: 2008-09-15 07:13:59 UTC
  • mfrom: (383.1.21 drizzle)
  • mto: This revision was merged to the branch mainline in revision 408.
  • Revision ID: stewart@flamingspork.com-20080915071359-f8bznznyaiqrtqxa
merged

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    str is a (long) to record position where 0 is the first position.
24
24
*/
25
25
 
26
 
#include "mysql_priv.h"
27
 
#include <assert.h>
 
26
#include <drizzled/server_includes.h>
 
27
#include <drizzled/drizzled_error_messages.h>
28
28
 
29
29
#define FCOMP                   17              /* Bytes for a packed field */
30
30
 
57
57
{
58
58
  virtual bool handle_error(uint sql_errno,
59
59
                            const char *message,
60
 
                            MYSQL_ERROR::enum_warning_level level,
 
60
                            DRIZZLE_ERROR::enum_warning_level level,
61
61
                            THD *thd);
62
62
  bool is_handled;
63
63
  Pack_header_error_handler() :is_handled(false) {}
68
68
Pack_header_error_handler::
69
69
handle_error(uint sql_errno,
70
70
             const char * /* message */,
71
 
             MYSQL_ERROR::enum_warning_level /* level */,
 
71
             DRIZZLE_ERROR::enum_warning_level /* level */,
72
72
             THD * /* thd */)
73
73
{
74
74
  is_handled= (sql_errno == ER_TOO_MANY_FIELDS);
184
184
  if (tmp_len < create_info->comment.length)
185
185
  {
186
186
    my_error(ER_WRONG_STRING_LENGTH, MYF(0),
187
 
             create_info->comment.str,"TABLE COMMENT",
 
187
             create_info->comment.str,"Table COMMENT",
188
188
             (uint) TABLE_COMMENT_MAXLEN);
189
189
    my_free(screen_buff,MYF(0));
190
190
    return(1);
206
206
      payload with a magic value to detect wrong buffer-sizes. We
207
207
      explicitly zero that segment again.
208
208
    */
209
 
    memset((char*) forminfo+47 + forminfo[46], 0, 61 - forminfo[46]);
 
209
    memset(forminfo+47 + forminfo[46], 0, 61 - forminfo[46]);
210
210
#endif
211
211
  }
212
212
 
257
257
    goto err;
258
258
 
259
259
  {
260
 
    memset((uchar*) buff, 0, 6);
 
260
    memset(buff, 0, 6);
261
261
    if (my_write(file, (uchar*) buff, 6, MYF_RW))
262
262
      goto err;
263
263
  }
314
314
  my_free(screen_buff,MYF(0));
315
315
  my_free(keybuff, MYF(0));
316
316
 
317
 
  if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
 
317
  if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
318
318
      (my_sync(file, MYF(MY_WME)) ||
319
319
       my_sync_dir_by_file(file_name, MYF(MY_WME))))
320
320
      goto err2;
468
468
    }
469
469
    cfield->row=(uint8_t) row;
470
470
    cfield->col=(uint8_t) (length+1);
471
 
    cfield->sc_length=(uint8_t) min(cfield->length,cols-(length+2));
 
471
    cfield->sc_length=(uint8_t) min(cfield->length,(uint32_t)cols-(length+2));
472
472
  }
473
473
  length=(uint) (pos-start_screen);
474
474
  int2store(start_screen,length);
522
522
  *pos++=(uchar) NAMES_SEP_CHAR;
523
523
  for (key=keyinfo ; key != end ; key++)
524
524
  {
525
 
    uchar *tmp=(uchar*) strmov((char*) pos,key->name);
 
525
    uchar *tmp=(uchar*) stpcpy((char*) pos,key->name);
526
526
    *tmp++= (uchar) NAMES_SEP_CHAR;
527
527
    *tmp=0;
528
528
    pos=tmp;
534
534
    if (key->flags & HA_USES_COMMENT)
535
535
    {
536
536
      int2store(pos, key->comment.length);
537
 
      uchar *tmp= (uchar*)strnmov((char*) pos+2,key->comment.str,key->comment.length);
 
537
      uchar *tmp= (uchar*)stpncpy((char*) pos+2,key->comment.str,key->comment.length);
538
538
      pos= tmp;
539
539
    }
540
540
  }
686
686
    return(1);
687
687
  }
688
688
  /* Hack to avoid bugs with small static rows in MySQL */
689
 
  reclength=max(file->min_record_length(table_options),reclength);
 
689
  reclength=max((ulong)file->min_record_length(table_options),reclength);
690
690
  if (info_length+(ulong) create_fields.elements*FCOMP+288+
691
691
      n_length+int_length+com_length > 65535L || int_count > 255)
692
692
  {
694
694
    return(1);
695
695
  }
696
696
 
697
 
  memset((char*)forminfo, 0, 288);
 
697
  memset(forminfo, 0, 288);
698
698
  length=(info_length+create_fields.elements*FCOMP+288+n_length+int_length+
699
699
          com_length);
700
700
  int2store(forminfo,length);
795
795
  it.rewind();
796
796
  while ((field=it++))
797
797
  {
798
 
    char *pos= strmov((char*) buff,field->field_name);
 
798
    char *pos= stpcpy((char*) buff,field->field_name);
799
799
    *pos++=NAMES_SEP_CHAR;
800
800
    if (i == create_fields.elements-1)
801
801
      *pos++=0;
892
892
  Field::utype type;
893
893
  uint null_count;
894
894
  uchar *buff,*null_pos;
895
 
  TABLE table;
 
895
  Table table;
896
896
  TABLE_SHARE share;
897
897
  Create_field *field;
898
898
  enum_check_fields old_count_cuted_fields= thd->count_cuted_fields;
899
899
  
900
900
 
901
901
  /* We need a table to generate columns for default values */
902
 
  memset((char*) &table, 0, sizeof(table));
903
 
  memset((char*) &share, 0, sizeof(share));
 
902
  memset(&table, 0, sizeof(table));
 
903
  memset(&share, 0, sizeof(share));
904
904
  table.s= &share;
905
905
 
906
906
  if (!(buff=(uchar*) my_malloc((size_t) reclength,MYF(MY_WME | MY_ZEROFILL))))