~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/csv/transparent_file.cc

  • Committer: Brian Aker
  • Date: 2008-12-19 07:02:38 UTC
  • Revision ID: brian@tangent.org-20081219070238-569uxp3vsr6r37v1
Updated/fix to foreign key test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
 
17
 
#include "config.h"
18
 
#include <cstdlib>
19
 
#include "drizzled/internal/my_sys.h"
 
17
#include <drizzled/server_includes.h>
20
18
#include "transparent_file.h"
21
19
 
22
 
using namespace drizzled;
23
 
 
24
20
Transparent_file::Transparent_file() : lower_bound(0), buff_size(IO_SIZE)
25
21
{
26
 
  buff= static_cast<unsigned char *>(malloc(buff_size*sizeof(unsigned char)));
 
22
  buff= (unsigned char *) malloc(buff_size*sizeof(unsigned char));
27
23
}
28
24
 
29
25
Transparent_file::~Transparent_file()
30
26
{
31
 
  free(buff);
 
27
  free((unsigned char*)buff);
32
28
}
33
29
 
34
 
void Transparent_file::init_buff(int filedes_arg)
 
30
void Transparent_file::init_buff(File filedes_arg)
35
31
{
36
32
  filedes= filedes_arg;
37
33
  /* read the beginning of the file */
38
34
  lower_bound= 0;
39
35
  lseek(filedes, 0, SEEK_SET);
40
36
  if (filedes && buff)
41
 
    upper_bound= internal::my_read(filedes, buff, buff_size, MYF(0));
 
37
    upper_bound= my_read(filedes, buff, buff_size, MYF(0));
42
38
}
43
39
 
44
40
unsigned char *Transparent_file::ptr()
64
60
     No need to seek here, as the file managed by Transparent_file class
65
61
     always points to upper_bound byte
66
62
  */
67
 
  if ((bytes_read= internal::my_read(filedes, buff, buff_size, MYF(0))) == MY_FILE_ERROR)
 
63
  if ((bytes_read= my_read(filedes, buff, buff_size, MYF(0))) == MY_FILE_ERROR)
68
64
    return (off_t) -1;
69
65
 
70
66
  /* end of file */
88
84
 
89
85
  lseek(filedes, offset, SEEK_SET);
90
86
  /* read appropriate portion of the file */
91
 
  if ((bytes_read= internal::my_read(filedes, buff, buff_size,
 
87
  if ((bytes_read= my_read(filedes, buff, buff_size,
92
88
                           MYF(0))) == MY_FILE_ERROR)
93
89
    return 0;
94
90