~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/csv/transparent_file.cc

  • Committer: Padraig O'Sullivan
  • Date: 2009-03-21 20:26:28 UTC
  • mto: (960.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 961.
  • Revision ID: osullivan.padraig@gmail.com-20090321202628-nh6qsi825m4d4av6
Removing the queues.[h,cc] files from the mysys directory. The only place
where they are needed now is in the MyISAM storage engine. Thus, I moved the
files there and updated the files in the MyISAM storage engine
appropriately.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
  along with this program; if not, write to the Free Software
14
14
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#ifdef USE_PRAGMA_IMPLEMENTATION
17
 
#pragma implementation        // gcc: Class implementation
18
 
#endif
19
16
 
20
 
#include <drizzled/common_includes.h>
 
17
#include <drizzled/server_includes.h>
21
18
#include "transparent_file.h"
22
19
 
23
20
Transparent_file::Transparent_file() : lower_bound(0), buff_size(IO_SIZE)
24
 
25
 
  buff= (unsigned char *) my_malloc(buff_size*sizeof(unsigned char),  MYF(MY_WME)); 
 
21
{
 
22
  buff= (unsigned char *) malloc(buff_size*sizeof(unsigned char));
26
23
}
27
24
 
28
25
Transparent_file::~Transparent_file()
29
 
30
 
  free((unsigned char*)buff); 
 
26
{
 
27
  free((unsigned char*)buff);
31
28
}
32
29
 
33
30
void Transparent_file::init_buff(File filedes_arg)
35
32
  filedes= filedes_arg;
36
33
  /* read the beginning of the file */
37
34
  lower_bound= 0;
38
 
  my_seek(filedes, 0, MY_SEEK_SET, MYF(0));
 
35
  lseek(filedes, 0, SEEK_SET);
39
36
  if (filedes && buff)
40
37
    upper_bound= my_read(filedes, buff, buff_size, MYF(0));
41
38
}
42
39
 
43
40
unsigned char *Transparent_file::ptr()
44
 
45
 
  return buff; 
 
41
{
 
42
  return buff;
46
43
}
47
44
 
48
45
off_t Transparent_file::start()
49
 
50
 
  return lower_bound; 
 
46
{
 
47
  return lower_bound;
51
48
}
52
49
 
53
50
off_t Transparent_file::end()
54
 
55
 
  return upper_bound; 
 
51
{
 
52
  return upper_bound;
56
53
}
57
54
 
58
55
off_t Transparent_file::read_next()
85
82
  if ((lower_bound <= offset) && (offset < upper_bound))
86
83
    return buff[offset - lower_bound];
87
84
 
88
 
  my_seek(filedes, offset, MY_SEEK_SET, MYF(0));
 
85
  lseek(filedes, offset, SEEK_SET);
89
86
  /* read appropriate portion of the file */
90
87
  if ((bytes_read= my_read(filedes, buff, buff_size,
91
88
                           MYF(0))) == MY_FILE_ERROR)