~ubuntu-branches/ubuntu/oneiric/firebird2.1/oneiric

« back to all changes in this revision

Viewing changes to src/jrd/blb.h

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2011-04-22 18:59:44 UTC
  • mfrom: (2.1.24 sid)
  • Revision ID: james.westby@ubuntu.com-20110422185944-egwy9r5xynjddku5
Tags: 2.1.4.18393-0.ds2-2
* apply patch from upstream SVN fixing ICU collations
* remove lintian overrides about manpages shipped in dependency package
* claim compliancy with Policy 3.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#define JRD_BLB_H
29
29
 
30
30
#include "../jrd/RecordNumber.h"
 
31
#include "../common/classes/array.h"
 
32
#include "../common/classes/File.h"
31
33
 
32
34
namespace Jrd {
33
35
 
126
128
 
127
129
/* Your basic blob block. */
128
130
 
129
 
class blb : public pool_alloc_rpt<UCHAR, type_blb>
 
131
class blb : public pool_alloc<type_blb>
130
132
{
131
 
    public:
 
133
public:
 
134
        blb(MemoryPool& pool, USHORT page_size)
 
135
                : blb_buffer(pool, page_size / sizeof(SLONG)),
 
136
                  blb_has_buffer(true)
 
137
        {
 
138
        }
 
139
 
132
140
        Attachment*     blb_attachment; /* database attachment */
133
141
        jrd_rel*        blb_relation;   /* Relation, if known */
134
142
        jrd_tra*        blb_transaction;        /* Parent transaction block */
157
165
        ULONG blb_lead_page;            /* First page number */
158
166
        ULONG blb_seek;                         /* Seek location */
159
167
        ULONG blb_temp_id;          // ID of newly created blob in transaction
160
 
        /* blb_data must be longword aligned */
161
 
        UCHAR blb_data[1];                      /* A page's worth of blob */
 
168
        size_t blb_temp_size;           // size stored in transaction temp space
 
169
        offset_t blb_temp_offset;               // offset in transaction temp space
 
170
 
 
171
private:
 
172
        Firebird::Array<SLONG> blb_buffer;      // buffer used in opened blobs - must be longword aligned
 
173
        bool blb_has_buffer;
 
174
 
 
175
public:
 
176
        bool hasBuffer() const
 
177
        {
 
178
                return blb_has_buffer;
 
179
        }
 
180
 
 
181
        UCHAR* getBuffer()
 
182
        {
 
183
                fb_assert(blb_has_buffer);
 
184
                return (UCHAR*) blb_buffer.begin();
 
185
        }
 
186
 
 
187
        void freeBuffer()
 
188
        {
 
189
                fb_assert(blb_has_buffer);
 
190
                blb_buffer.free();
 
191
                blb_has_buffer = false;
 
192
        }
162
193
};
163
194
 
164
195
const int BLB_temporary = 1;                    /* Newly created blob */