本文整理汇总了Java中org.hsqldb.Database类的典型用法代码示例。如果您正苦于以下问题:Java Database类的具体用法?Java Database怎么用?Java Database使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Database类属于org.hsqldb包,在下文中一共展示了Database类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ScaledRAFile
import org.hsqldb.Database; //导入依赖的package包/类
ScaledRAFile(Database database, String name, RandomAccessFile file,
boolean readonly) throws FileNotFoundException, IOException {
this.appLog = database.logger.appLog;
this.readOnly = readonly;
this.fileName = name;
this.file = file;
int bufferScale = database.getProperties().getIntegerProperty(
HsqlDatabaseProperties.hsqldb_raf_buffer_scale, 12, 8, 13);
int bufferSize = 1 << bufferScale;
buffer = new byte[bufferSize];
ba = new HsqlByteArrayInputStream(buffer);
fileDescriptor = file.getFD();
fileLength = length();
}
示例2: ScaledRAFile
import org.hsqldb.Database; //导入依赖的package包/类
ScaledRAFile(Database database, String name,
boolean readonly) throws FileNotFoundException, IOException {
this.appLog = database.logger.appLog;
this.readOnly = readonly;
this.fileName = name;
this.file = new RandomAccessFile(name, readonly ? "r"
: "rw");
int bufferScale = database.getProperties().getIntegerProperty(
HsqlDatabaseProperties.hsqldb_raf_buffer_scale, 12);
int bufferSize = 1 << bufferScale;
buffer = new byte[bufferSize];
ba = new HsqlByteArrayInputStream(buffer);
fileLength = length();
}
示例3: RAShadowFile
import org.hsqldb.Database; //导入依赖的package包/类
RAShadowFile(Database database, RandomAccessInterface source,
String pathName, long maxSize, int pageSize) {
this.database = database;
this.pathName = pathName;
this.source = source;
this.pageSize = pageSize;
this.maxSize = maxSize;
int bitSize = (int) (maxSize / pageSize);
if (maxSize % pageSize != 0) {
bitSize++;
}
bitMap = new BitMap(bitSize, false);
buffer = new byte[pageSize + headerSize];
byteArrayOutputStream = new HsqlByteArrayOutputStream(buffer);
}
示例4: initParams
import org.hsqldb.Database; //导入依赖的package包/类
protected void initParams(Database database, String fileSettingsString,
boolean defrag) {
this.database = database;
fa = FileUtil.getFileUtil();
textFileSettings = new TextFileSettings(database, fileSettingsString);
dataFileName = textFileSettings.getFileName();
if (dataFileName == null) {
throw Error.error(ErrorCode.X_S0501);
}
dataFileName = ((FileUtil) fa).canonicalOrAbsolutePath(dataFileName);
maxCacheRows = textFileSettings.getMaxCacheRows();
maxCacheBytes = textFileSettings.getMaxCacheBytes();
// max size is 256G
maxDataFileSize = (long) Integer.MAX_VALUE * Logger.largeDataFactor;
cachedRowPadding = 1;
dataFileScale = 1;
}
示例5: RAShadowFile
import org.hsqldb.Database; //导入依赖的package包/类
RAShadowFile(Database database, RandomAccessInterface source,
String pathName, long maxSize, int pageSize) {
this.database = database;
this.pathName = pathName;
this.source = source;
this.pageSize = pageSize;
this.maxSize = maxSize;
int bitSize = (int) (maxSize / pageSize);
if (maxSize % pageSize != 0) {
bitSize++;
}
bitMap = new BitMap(bitSize, false);
buffer = new byte[pageSize + 12];
byteArrayOutputStream = new HsqlByteArrayOutputStream(buffer);
}
示例6: deleteFile
import org.hsqldb.Database; //导入依赖的package包/类
static void deleteFile(Database database, String fileName) {
FileAccess fileAccess = database.logger.getFileAccess();
// first attemp to delete
fileAccess.removeElement(fileName);
if (database.logger.isStoredFileAccess()) {
return;
}
if (fileAccess.isStreamElement(fileName)) {
database.logger.log.deleteOldDataFiles();
fileAccess.removeElement(fileName);
if (fileAccess.isStreamElement(fileName)) {
String discardName = FileUtil.newDiscardFileName(fileName);
fileAccess.renameElement(fileName, discardName);
}
}
}
示例7: RAShadowFile
import org.hsqldb.Database; //导入依赖的package包/类
RAShadowFile(Database database, Storage source, String pathName,
long maxSize, int pageSize) {
this.database = database;
this.pathName = pathName;
this.source = source;
this.pageSize = pageSize;
this.maxSize = maxSize;
int bitSize = (int) (maxSize / pageSize);
if (maxSize % pageSize != 0) {
bitSize++;
}
bitMap = new BitMap(bitSize);
}
示例8: ScaledRAFile
import org.hsqldb.Database; //导入依赖的package包/类
ScaledRAFile(Database database, String name,
boolean readonly) throws FileNotFoundException, IOException {
this.appLog = database.logger.appLog;
this.readOnly = readonly;
this.fileName = name;
this.file = new RandomAccessFile(name, readonly ? "r"
: "rw");
int bufferScale = database.getProperties().getIntegerProperty(
HsqlDatabaseProperties.hsqldb_raf_buffer_scale, 12);
int bufferSize = 1 << bufferScale;
buffer = new byte[bufferSize];
ba = new HsqlByteArrayInputStream(buffer);
}
示例9: ScriptWriterBase
import org.hsqldb.Database; //导入依赖的package包/类
ScriptWriterBase(Database db, OutputStream outputStream,
FileAccess.FileSync descriptor,
boolean includeCachedData) {
initBuffers();
this.database = db;
this.includeCachedData = includeCachedData;
this.includeIndexRoots = !includeCachedData;
currentSession = database.sessionManager.getSysSession();
// start with neutral schema - no SET SCHEMA to log
schemaToLog = currentSession.loggedSchema =
currentSession.currentSchema;
fileStreamOut = new BufferedOutputStream(outputStream, 1 << 14);
outDescriptor = descriptor;
}
示例10: LobStoreRAFile
import org.hsqldb.Database; //导入依赖的package包/类
public LobStoreRAFile(Database database, int lobBlockSize) {
this.lobBlockSize = lobBlockSize;
this.database = database;
try {
String name = database.getPath() + ".lobs";
boolean exists =
database.logger.getFileAccess().isStreamElement(name);
if (exists) {
openFile();
}
} catch (Throwable t) {
throw Error.error(ErrorCode.DATA_FILE_ERROR, t);
}
}
示例11: DataFileDefrag
import org.hsqldb.Database; //导入依赖的package包/类
DataFileDefrag(Database db, DataFileCache cache) {
this.database = db;
this.dataCache = cache;
this.scale = cache.getDataFileScale();
this.dataFileName = cache.getFileName();
}
示例12: GranteeManager
import org.hsqldb.Database; //导入依赖的package包/类
/**
* Construct the GranteeManager for a Database. Construct special Grantee
* objects for _SYSTEM, PUBLIC and DBA, and add them to the Grantee map.
*
* @param database Only needed to link to the RoleManager later on.
*/
public GranteeManager(Database database) {
this.database = database;
// map.add(systemAuthorisation.getNameString(), systemAuthorisation);
// roleMap.add(systemAuthorisation.getNameString(), systemAuthorisation);
addRole(
this.database.nameManager.newHsqlName(
SqlInvariants.PUBLIC_ROLE_NAME, false, SchemaObject.GRANTEE));
publicRole = getRole(SqlInvariants.PUBLIC_ROLE_NAME);
publicRole.isPublic = true;
addRole(
this.database.nameManager.newHsqlName(
SqlInvariants.DBA_ADMIN_ROLE_NAME, false,
SchemaObject.GRANTEE));
dbaRole = getRole(SqlInvariants.DBA_ADMIN_ROLE_NAME);
dbaRole.setAdminDirect();
addRole(
this.database.nameManager.newHsqlName(
SqlInvariants.SCHEMA_CREATE_ROLE_NAME, false,
SchemaObject.GRANTEE));
schemaRole = getRole(SqlInvariants.SCHEMA_CREATE_ROLE_NAME);
addRole(
this.database.nameManager.newHsqlName(
SqlInvariants.CHANGE_AUTH_ROLE_NAME, false,
SchemaObject.GRANTEE));
changeAuthRole = getRole(SqlInvariants.CHANGE_AUTH_ROLE_NAME);
}
示例13: RAFileHybrid
import org.hsqldb.Database; //导入依赖的package包/类
public RAFileHybrid(Database database, String name,
boolean readOnly) throws IOException {
this.database = database;
this.fileName = name;
this.isReadOnly = readOnly;
long fileLength;
java.io.File fi = new java.io.File(name);
fileLength = fi.length();
newStore(fileLength);
}
示例14: newScriptReader
import org.hsqldb.Database; //导入依赖的package包/类
public static ScriptReaderBase newScriptReader(Database db, String file,
int scriptType) throws HsqlException, IOException {
if (scriptType == ScriptWriterBase.SCRIPT_TEXT_170) {
return new ScriptReaderText(db, file);
} else if (scriptType == ScriptWriterBase.SCRIPT_BINARY_172) {
return new ScriptReaderBinary(db, file);
} else {
return new ScriptReaderZipped(db, file);
}
}
示例15: initParams
import org.hsqldb.Database; //导入依赖的package包/类
/**
* Initial external parameters are set here. The size if fixed.
*/
protected void initParams(Database database, String baseFileName,
boolean defrag) {
this.dataFileName = baseFileName + ".data.tmp";
this.database = database;
fa = FileUtil.getFileUtil();
dataFileScale = 64;
cachedRowPadding = dataFileScale;
initialFreePos = dataFileScale;
maxCacheRows = 2048;
maxCacheBytes = maxCacheRows * 1024L;
maxDataFileSize = (long) Integer.MAX_VALUE * dataFileScale;
}