~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/str/load_file.cc

  • Committer: Mark Atwood
  • Date: 2011-10-27 05:08:12 UTC
  • mfrom: (2445.1.11 rf)
  • Revision ID: me@mark.atwood.name-20111027050812-1icvs72lb0u4xdc4
mergeĀ lp:~olafvdspek/drizzle/refactor8

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
 
20
#include <config.h>
21
21
#include <drizzled/function/str/strfunc.h>
22
22
#include <drizzled/function/str/load_file.h>
23
23
#include <drizzled/error.h>
24
24
#include <drizzled/data_home.h>
25
25
#include <drizzled/session.h>
26
 
#include "drizzled/internal/my_sys.h"
 
26
#include <drizzled/internal/my_sys.h>
 
27
#include <drizzled/sys_var.h>
 
28
#include <drizzled/system_variables.h>
27
29
 
28
30
#include <boost/filesystem.hpp>
29
31
 
47
49
  if (!(file_name= args[0]->val_str(str)))
48
50
  {
49
51
    null_value = 1;
50
 
    return(0);
 
52
    return 0;
51
53
  }
52
54
 
53
55
  fs::path target_path(fs::system_complete(getDataHomeCatalog()));
100
102
    goto err;
101
103
  }
102
104
 
103
 
  if (tmp_value.alloc((size_t)stat_info.st_size))
104
 
    goto err;
 
105
  tmp_value.alloc((size_t)stat_info.st_size);
105
106
  if ((file = internal::my_open(target_path.file_string().c_str(), O_RDONLY, MYF(0))) < 0)
106
107
    goto err;
107
108
  if (internal::my_read(file, (unsigned char*) tmp_value.ptr(), (size_t)stat_info.st_size, MYF(MY_NABP)))
120
121
 
121
122
err:
122
123
  null_value = 1;
123
 
  return(0);
 
124
  return 0;
124
125
}
125
126
 
126
127