1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.healthmarketscience.jackcess.impl;
18
19 import java.io.IOException;
20 import java.nio.charset.Charset;
21
22
23
24
25
26
27
28 abstract class DBMutator
29 {
30 private final DatabaseImpl _database;
31
32 protected DBMutator(DatabaseImpl database) {
33 _database = database;
34 }
35
36 public DatabaseImpl getDatabase() {
37 return _database;
38 }
39
40 public JetFormat getFormat() {
41 return _database.getFormat();
42 }
43
44 public PageChannel getPageChannel() {
45 return _database.getPageChannel();
46 }
47
48 public Charset getCharset() {
49 return _database.getCharset();
50 }
51
52 public int reservePageNumber() throws IOException {
53 return getPageChannel().allocateNewPage();
54 }
55
56 public static int calculateNameLength(String name) {
57 return (name.length() * JetFormat.TEXT_FIELD_UNIT_SIZE) + 2;
58 }
59
60 protected ColumnImpl.SortOrder getDbSortOrder() {
61 try {
62 return _database.getDefaultSortOrder();
63 } catch(IOException e) {
64
65 }
66 return null;
67 }
68 }