~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_load.cc

Remove PLUGIN and MODULES.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
/* Copy data from a textfile to table */
18
18
 
19
 
#include <drizzled/server_includes.h>
 
19
#include "config.h"
20
20
#include <drizzled/sql_load.h>
21
21
#include <drizzled/error.h>
22
22
#include <drizzled/data_home.h>
23
23
#include <drizzled/session.h>
24
24
#include <drizzled/sql_base.h>
25
25
#include <drizzled/field/timestamp.h>
 
26
#include "drizzled/internal/my_sys.h"
 
27
#include "drizzled/internal/iocache.h"
 
28
#include <drizzled/db.h>
26
29
 
 
30
#include <sys/stat.h>
 
31
#include <fcntl.h>
27
32
#include <algorithm>
 
33
#include <climits>
28
34
 
 
35
using namespace drizzled;
29
36
using namespace std;
30
37
 
31
38
class READ_INFO {
32
 
  File  cursor;
 
39
  int   cursor;
33
40
  unsigned char *buffer;                /* Buffer for read text */
34
41
  unsigned char *end_of_buff;           /* Data in bufferts ends here */
35
42
  size_t buff_length;                   /* Length of buffert */
48
55
        *row_end;                       /* Found row ends here */
49
56
  const CHARSET_INFO *read_charset;
50
57
 
51
 
  READ_INFO(File cursor, size_t tot_length, const CHARSET_INFO * const cs,
 
58
  READ_INFO(int cursor, size_t tot_length, const CHARSET_INFO * const cs,
52
59
            String &field_term,String &line_start,String &line_term,
53
60
            String &enclosed,int escape, bool is_fifo);
54
61
  ~READ_INFO();
115
122
                enum enum_duplicates handle_duplicates, bool ignore)
116
123
{
117
124
  char name[FN_REFLEN];
118
 
  File file;
 
125
  int file;
119
126
  Table *table= NULL;
120
127
  int error;
121
128
  String *field_term=ex->field_term,*escaped=ex->escaped;
289
296
    }
290
297
    if ((file=my_open(name,O_RDONLY,MYF(MY_WME))) < 0)
291
298
    {
292
 
      my_error(ER_CANT_OPEN_FILE, MYF(0), name, my_errno);
 
299
      my_error(ER_CANT_OPEN_FILE, MYF(0), name, errno);
293
300
      return(true);
294
301
    }
295
302
  }
357
364
                            *enclosed, skip_lines, ignore);
358
365
    if (table->cursor->ha_end_bulk_insert() && !error)
359
366
    {
360
 
      table->print_error(my_errno, MYF(0));
 
367
      table->print_error(errno, MYF(0));
361
368
      error= 1;
362
369
    }
363
370
    table->cursor->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
729
736
*/
730
737
 
731
738
 
732
 
READ_INFO::READ_INFO(File file_par, size_t tot_length,
 
739
READ_INFO::READ_INFO(int file_par, size_t tot_length,
733
740
                     const CHARSET_INFO * const cs,
734
741
                     String &field_term, String &line_start, String &line_term,
735
742
                     String &enclosed_par, int escape, bool is_fifo)
769
776
  /* Set of a stack for unget if long terminators */
770
777
  uint32_t length= max(field_term_length,line_term_length)+1;
771
778
  set_if_bigger(length,line_start.length());
772
 
  stack= stack_pos= (int*) sql_alloc(sizeof(int)*length);
 
779
  stack= stack_pos= (int*) memory::sql_alloc(sizeof(int)*length);
773
780
 
774
781
  if (!(buffer=(unsigned char*) calloc(1, buff_length+1)))
775
782
    error=1;