1 //
2 // Copyright (C) 2004-2008 Maciej Sobczak, Stephen Hutton
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 //
7
8 #define SOCI_SOURCE
9 #include "soci/blob.h"
10 #include "soci/session.h"
11
12 #include <cstddef>
13
14 using namespace soci;
15
blob(session & s)16 blob::blob(session & s)
17 {
18 backEnd_ = s.make_blob_backend();
19 }
20
~blob()21 blob::~blob()
22 {
23 delete backEnd_;
24 }
25
get_len()26 std::size_t blob::get_len()
27 {
28 return backEnd_->get_len();
29 }
30
read(std::size_t offset,char * buf,std::size_t toRead)31 std::size_t blob::read(std::size_t offset, char *buf, std::size_t toRead)
32 {
33 return backEnd_->read(offset, buf, toRead);
34 }
35
read_from_start(char * buf,std::size_t toRead,std::size_t offset)36 std::size_t blob::read_from_start(char * buf, std::size_t toRead,
37 std::size_t offset)
38 {
39 return backEnd_->read_from_start(buf, toRead, offset);
40 }
41
write(std::size_t offset,char const * buf,std::size_t toWrite)42 std::size_t blob::write(
43 std::size_t offset, char const * buf, std::size_t toWrite)
44 {
45 return backEnd_->write(offset, buf, toWrite);
46 }
47
write_from_start(const char * buf,std::size_t toWrite,std::size_t offset)48 std::size_t blob::write_from_start(const char * buf, std::size_t toWrite,
49 std::size_t offset)
50 {
51 return backEnd_->write_from_start(buf, toWrite, offset);
52 }
53
append(char const * buf,std::size_t toWrite)54 std::size_t blob::append(char const * buf, std::size_t toWrite)
55 {
56 return backEnd_->append(buf, toWrite);
57 }
58
trim(std::size_t newLen)59 void blob::trim(std::size_t newLen)
60 {
61 backEnd_->trim(newLen);
62 }
63