36 #include <mix/mutex.h>
38 #include <ldb/DbTableTypes.H>
40 #include <ldb/DbFileStorage.H>
52 #define DB_START_VOLUME 500
55 #define DB_NORMAL_PREREAD (500*1024)
58 #define DB_LARGE_PREREAD (10*1024*1024)
61 #define DB_SMALL_PREREAD (50*1024)
112 virtual DbIndex
lines_range (DbIndex line1, DbIndex line2,
113 DbIndex* line = NULL)
const;
116 virtual void get_value (
const char* column, DbIndex line,
122 virtual void get_values (
const char* column, DbIndex start_line,
123 DbIndex lines_cnt,
void* ptr);
129 virtual UnitId
get_unit (
const char* column)
const;
139 DbIndex line1, DbIndex line2);
158 virtual void clean ();
161 virtual void set_value (
const char* column, DbIndex line,
167 virtual void set_values (
const char* column, DbIndex start_line,
168 DbIndex lines_cnt,
const void* ptr);
174 virtual void set_unit (
const char* column, UnitId unid);
179 virtual void insert_line (DbIndex line, DbIndex lines_cnt = 1,
183 virtual void remove_lines (DbIndex line1, DbIndex line2);
194 DbIndex iFrom, DbIndex nLines);
232 void read_leader (
int fd, ByteOrder& eBO, DbIndex& nLineCnt,
238 void append_table (
int fd, ByteOrder eBO, DbIndex nLineCnt);
249 void write_leader (
int fd, ByteOrder eBO, DbIndex nLineCnt);
255 DbIndex iStartLine, DbIndex nLineCnt);
281 MutexId*
mutex ()
const;
291 virtual void read_lines (DbIndex line1, DbIndex line2);
295 virtual void write_lines (DbIndex line1, DbIndex line2);
310 virtual void load_lines (DbIndex line1, DbIndex line2);
314 virtual void change_lines (DbIndex line1, DbIndex line2);
323 unsigned n2i (
const char* column)
const;
327 virtual unsigned valid_n2i (
const char* column)
const;
331 void*
i2ptr (
unsigned dmn_i, DbIndex line)
const
333 DbIndex line_i = (_last_ == line)?
lines_count() - 1: line;
335 +
fmt.
dmns->fetch(dmn_i).offset;
342 return dd.
dim * AtomTypeToSize[dd.
atype];
371 Logic bLoadErrorSaid, bSaveErrorSaid;
373 #ifdef DB_RW_LOG_ENABLED
383 std::map<std::string,unsigned> mHash;
virtual void remove_lines(DbIndex line1, DbIndex line2)
virtual void set_values(const char *column, DbIndex start_line, DbIndex lines_cnt, const void *ptr)
void write_leader(int fd, ByteOrder eBO, DbIndex nLineCnt)
DbTTDesc fmt
Definition: DbTable.H:348
virtual Logic check_empty_value(const char *column, DbIndex line)
void read_leader(int fd, ByteOrder &eBO, DbIndex &nLineCnt, unsigned &nDmnsCnt)
virtual const DmnDescAr & get_domains()
virtual void read_lines(DbIndex line1, DbIndex line2)
const char * tt_name() const
virtual void load_lines(DbIndex line1, DbIndex line2)
virtual void set_modifiability(Logic bFlag)
virtual void set_unit(const char *column, UnitId unid)
DbBufStorage dtable
Definition: DbTable.H:351
DmnDescAr * dmns
Definition: DbTableTypes.H:65
const DbTTDesc & table_format() const
Definition: DbTable.H:396
Definition: DbBufStorage.H:275
virtual void write_line_seq(DbIndex line1, DbIndex line2)
virtual DbDomainDesc get_domain(const char *column) const
size_t i2size(unsigned dmn_i) const
Definition: DbTable.H:339
void * line_pointer(DbIndex line) const
virtual void get_values(const char *column, DbIndex start_line, DbIndex lines_cnt, void *ptr)
DbTable(const DbTTDesc &dbtt, DbIndex quant=DB_QUANT, DbIndex start_volume=DB_START_VOLUME)
virtual DbIndex lines_range(DbIndex line1, DbIndex line2, DbIndex *line=NULL) const
size_t get_preread_size() const
void record_table(int fd, ByteOrder eBO, DbIndex iStartLine, DbIndex nLineCnt)
#define DB_QUANT
Definition: DbTable.H:48
virtual void exchange_lines(DbIndex line1, DbIndex line2)
virtual UnitId get_unit(const char *column) const
virtual void merge(DbTable &src)
virtual void copy_lines(DbIndex iWhere, DbTable &src, DbIndex iFrom, DbIndex nLines)
virtual void insert_line(DbIndex line, DbIndex lines_cnt=1, Logic bInit=TRUE)
virtual void get_value(const char *column, DbIndex line, void *ptr)
void append_table(int fd, ByteOrder eBO, DbIndex nLineCnt)
Logic is_modifiable() const
virtual void set_empty_value(const char *column, DbIndex line)
virtual unsigned valid_n2i(const char *column) const
void set_preread_size(size_t nSize)
virtual Compar compare_lines(const char *column, DbIndex line1, DbIndex line2)
unsigned nFileDmnsCnt
Definition: DbTable.H:358
virtual void write_lines(DbIndex line1, DbIndex line2)
virtual void not_modified()
virtual void read_line_seq(DbIndex line1, DbIndex line2)
virtual void change_lines(DbIndex line1, DbIndex line2)
Definition: DbTableTypes.H:61
Logic is_modified() const
AtomType atype
Definition: dbdefs.h:172
void * i2ptr(unsigned dmn_i, DbIndex line) const
Definition: DbTable.H:331
virtual DbIndex lines_count() const
virtual void set_value(const char *column, DbIndex line, const void *ptr)
Int4 dim
Definition: dbdefs.h:173
#define DB_START_VOLUME
Definition: DbTable.H:52
unsigned n2i(const char *column) const
DbFileDomainAttr * dmn_attrs
Definition: DbTable.H:354