本文整理汇总了Java中org.hsqldb.DatabaseURL类的典型用法代码示例。如果您正苦于以下问题:Java DatabaseURL类的具体用法?Java DatabaseURL怎么用?Java DatabaseURL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DatabaseURL类属于org.hsqldb包,在下文中一共展示了DatabaseURL类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setLocalVariables
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
private void setLocalVariables() {
if (connProperties == null) {
return;
}
isCloseResultSet = connProperties.isPropertyTrue(
HsqlDatabaseProperties.url_close_result, false);
isUseColumnName = connProperties.isPropertyTrue(
HsqlDatabaseProperties.url_get_column_name, true);
isEmptyBatchAllowed = connProperties.isPropertyTrue(
HsqlDatabaseProperties.url_allow_empty_batch, false);
isTranslateTTIType = clientProperties.isPropertyTrue(
HsqlDatabaseProperties.jdbc_translate_tti_types, true);
isStoreLiveObject = clientProperties.isPropertyTrue(
HsqlDatabaseProperties.sql_live_object, false);
if (isStoreLiveObject) {
String connType = connProperties.getProperty("connection_type");
if(!DatabaseURL.S_MEM.equals(connType))
isStoreLiveObject = false;
}
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:24,代码来源:JDBCConnection.java
示例2: acceptsURL
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
/**
* Returns true if the driver thinks that it can open a connection to
* the given URL. Typically drivers will return true if they understand
* the subprotocol specified in the URL and false if they don't.
*
* @param url the URL of the database
* @return true if this driver can connect to the given URL
*/
// [email protected] - patch 1.7.0 - allow mixedcase url's
public boolean acceptsURL(String url) {
if (url == null) {
return false;
}
if (url.regionMatches(true, 0, DatabaseURL.S_URL_PREFIX, 0,
DatabaseURL.S_URL_PREFIX.length())) {
return true;
}
if (url.regionMatches(true, 0, DatabaseURL.S_URL_INTERNAL, 0,
DatabaseURL.S_URL_INTERNAL.length())) {
return true;
}
return false;
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:29,代码来源:JDBCDriver.java
示例3: save
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
public void save() {
if (!DatabaseURL.isFileBasedDatabaseType(database.getType())
|| database.isFilesReadOnly() || database.isFilesInJar()) {
return;
}
try {
super.save(fileName + ".properties" + ".new");
fa.renameElement(fileName + ".properties" + ".new",
fileName + ".properties");
} catch (Exception e) {
database.logger.appLog.logContext(SimpleLog.LOG_ERROR, "failed");
throw Error.error(ErrorCode.FILE_IO_ERROR,
ErrorCode.M_LOAD_SAVE_PROPERTIES, new Object[] {
fileName, e
});
}
}
开发者ID:s-store,项目名称:sstore-soft,代码行数:21,代码来源:HsqlDatabaseProperties.java
示例4: save
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
public void save() throws HsqlException {
if (!DatabaseURL.isFileBasedDatabaseType(database.getType())
|| database.isFilesReadOnly() || database.isFilesInJar()) {
return;
}
try {
super.save(fileName + ".properties" + ".new");
fa.renameElement(fileName + ".properties" + ".new",
fileName + ".properties");
} catch (Exception e) {
database.logger.appLog.logContext(SimpleLog.LOG_ERROR, "failed");
throw Trace.error(Trace.FILE_IO_ERROR, Trace.LOAD_SAVE_PROPERTIES,
new Object[] {
fileName, e
});
}
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:HsqlDatabaseProperties.java
示例5: getSecurePath
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
/**
* Returns a secure path or null for a user-defined path when
* hsqldb.allow_full_path is false. Returns the path otherwise.
*
*/
public String getSecurePath(String path) {
if (database.getType() == DatabaseURL.S_RES) {
return path;
}
if (path.indexOf("..") != -1) {
if (database.logger.propTextAllowFullPath) {
return FileUtil.getFileUtil().canonicalOrAbsolutePath(path);
} else {
return null;
}
}
String fullPath =
new File(new File(database.getPath()
+ ".properties").getAbsolutePath()).getParent();
if (fullPath != null) {
path = fullPath + File.separator + path;
}
return path;
}
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:30,代码来源:Logger.java
示例6: open
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
public void open() {
if (DatabaseURL.isFileBasedDatabaseType(database.getType())) {
lobStore = new LobStoreRAFile(database, lobBlockSize);
} else {
lobStore = new LobStoreMem(lobBlockSize);
}
}
开发者ID:s-store,项目名称:sstore-soft,代码行数:9,代码来源:LobManager.java
示例7: acceptsURL
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
/**
* Returns true if the driver thinks that it can open a connection to
* the given URL. Typically drivers will return true if they understand
* the subprotocol specified in the URL and false if they don't.
*
* @param url the URL of the database
* @return true if this driver can connect to the given URL
*/
// [email protected] - patch 1.7.0 - allow mixedcase url's
public boolean acceptsURL(String url) {
if (url == null) {
return false;
}
return url.regionMatches(true, 0, DatabaseURL.S_URL_PREFIX, 0,
DatabaseURL.S_URL_PREFIX.length());
}
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:JDBCDriver.java
示例8: open
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
/**
* Opens a data source file.
*/
public void open(boolean readonly) {
fileFreePosition = 0;
try {
int type = database.getType() == DatabaseURL.S_RES
? RAFile.DATA_FILE_JAR
: RAFile.DATA_FILE_TEXT;
dataFile = RAFile.newScaledRAFile(database, dataFileName,
readonly, type);
fileFreePosition = dataFile.length();
if (fileFreePosition > maxDataFileSize) {
throw Error.error(ErrorCode.DATA_FILE_IS_FULL);
}
initBuffers();
spaceManager = new DataSpaceManagerSimple(this);
} catch (Throwable t) {
throw Error.error(t, ErrorCode.FILE_IO_ERROR,
ErrorCode.M_TextCache_opening_file_error,
new Object[] {
t.toString(), dataFileName
});
}
cacheReadonly = readonly;
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:34,代码来源:TextCache.java
示例9: save
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
public void save() {
if (!DatabaseURL.isFileBasedDatabaseType(database.getType())
|| database.isFilesReadOnly() || database.isFilesInJar()) {
return;
}
try {
HsqlProperties props = new HsqlProperties(dbMeta,
database.getPath(), database.logger.getFileAccess(), false);
if (getIntegerProperty(hsqldb_script_format) == 3) {
props.setProperty(hsqldb_script_format, 3);
}
props.setProperty(hsqldb_version, THIS_VERSION);
if (database.logger.isStoredFileAccess()) {
if (!database.logger.isNewStoredFileAccess()) {
// when jar is used with embedded databases in AOO 3.4 and recent(2012) LO this
// line can be uncommented to circumvent hard-coded check in OOo code in
// drivers/hsqldb/HDriver.cxx
// props.setProperty(hsqldb_version, VERSION_STRING_1_8_0);
}
}
props.setProperty(hsqldb_modified, getProperty(hsqldb_modified));
props.save(fileName + ".properties" + ".new");
fa.renameElement(fileName + ".properties" + ".new",
fileName + ".properties");
} catch (Throwable t) {
database.logger.logSevereEvent("save failed", t);
throw Error.error(t, ErrorCode.FILE_IO_ERROR,
ErrorCode.M_LOAD_SAVE_PROPERTIES, new Object[] {
t.toString(), fileName
});
}
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:41,代码来源:HsqlDatabaseProperties.java
示例10: open
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
public void open() {
lobBlockSize = database.logger.getLobBlockSize();
cryptLobs = database.logger.cryptLobs;
compressLobs = database.logger.propCompressLobs;
if (compressLobs || cryptLobs) {
int largeBufferBlockSize = largeLobBlockSize + 4 * 1024;
inflater = new Inflater();
deflater = new Deflater(Deflater.BEST_SPEED);
dataBuffer = new byte[largeBufferBlockSize];
}
if (database.getType() == DatabaseURL.S_RES) {
lobStore = new LobStoreInJar(database, lobBlockSize);
} else if (database.getType() == DatabaseURL.S_FILE) {
lobStore = new LobStoreRAFile(database, lobBlockSize);
if (!database.isFilesReadOnly()) {
byteBuffer = new byte[lobBlockSize];
initialiseLobSpace();
}
} else {
lobStore = new LobStoreMem(lobBlockSize);
byteBuffer = new byte[lobBlockSize];
initialiseLobSpace();
}
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:32,代码来源:LobManager.java
示例11: open
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
/**
* Opens a data source file.
*/
public void open(boolean readonly) throws HsqlException {
fileFreePosition = 0;
try {
int type = database.getType() == DatabaseURL.S_RES
? ScaledRAFile.DATA_FILE_JAR
: ScaledRAFile.DATA_FILE_RAF;
dataFile = ScaledRAFile.newScaledRAFile(database, fileName,
readonly, type, null, null);
fileFreePosition = dataFile.length();
if (fileFreePosition > Integer.MAX_VALUE) {
throw new IOException();
}
initBuffers();
} catch (Exception e) {
throw Trace.error(Trace.FILE_IO_ERROR,
Trace.TextCache_openning_file_error,
new Object[] {
fileName, e
});
}
cacheReadonly = readonly;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:TextCache.java
示例12: openTextCache
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
DataFileCache openTextCache(Table table, String source,
boolean readOnlyData,
boolean reversed) throws HsqlException {
closeTextCache(table);
if (database.getType() != DatabaseURL.S_RES
&& !properties.isPropertyTrue(
HsqlDatabaseProperties.textdb_allow_full_path)) {
if (source.indexOf("..") != -1) {
throw (Trace.error(Trace.ACCESS_IS_DENIED, source));
}
String path = new File(
new File(
database.getPath()
+ ".properties").getAbsolutePath()).getParent();
if (path != null) {
source = path + File.separator + source;
}
}
TextCache c;
int type;
if (reversed) {
c = new TextCache(table, source);
} else {
c = new TextCache(table, source);
}
c.open(readOnlyData || filesReadOnly);
textCacheList.put(table.getName(), c);
return c;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:38,代码来源:Log.java
示例13: open
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
/**
* Opens a data source file.
*/
public void open(boolean readonly) {
fileFreePosition = 0;
try {
int type = database.getType() == DatabaseURL.S_RES
? ScaledRAFile.DATA_FILE_JAR
: ScaledRAFile.DATA_FILE_TEXT;
dataFile = ScaledRAFile.newScaledRAFile(database, dataFileName,
readonly, type);
fileFreePosition = dataFile.length();
if (fileFreePosition > Integer.MAX_VALUE) {
throw Error.error(ErrorCode.DATA_FILE_IS_FULL);
}
initBuffers();
freeBlocks = new DataFileBlockManager(0, cacheFileScale, 0, 0);
} catch (Throwable t) {
throw Error.error(t, ErrorCode.FILE_IO_ERROR,
ErrorCode.M_TextCache_openning_file_error,
new Object[] {
t.toString(), dataFileName
});
}
cacheReadonly = readonly;
}
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:34,代码来源:TextCache.java
示例14: save
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
public void save() {
if (!DatabaseURL.isFileBasedDatabaseType(database.getType())
|| database.isFilesReadOnly() || database.isFilesInJar()) {
return;
}
try {
HsqlProperties props = new HsqlProperties(dbMeta,
database.getPath(), database.logger.getFileAccess(), false);
if (getIntegerProperty(hsqldb_script_format) == 3) {
props.setProperty(hsqldb_script_format, 3);
}
props.setProperty(hsqldb_version, THIS_VERSION);
props.setProperty(hsqldb_modified, getProperty(hsqldb_modified));
props.save(fileName + ".properties" + ".new");
fa.renameElement(fileName + ".properties" + ".new",
fileName + ".properties");
} catch (Throwable t) {
database.logger.logSevereEvent("save failed", t);
throw Error.error(t, ErrorCode.FILE_IO_ERROR,
ErrorCode.M_LOAD_SAVE_PROPERTIES, new Object[] {
t.toString(), fileName
});
}
}
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:30,代码来源:HsqlDatabaseProperties.java
示例15: open
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
public void open() {
lobBlockSize = database.logger.getLobBlockSize();
if (database.getType() == DatabaseURL.S_RES) {
lobStore = new LobStoreInJar(database, lobBlockSize);
} else if (database.getType() == DatabaseURL.S_FILE) {
lobStore = new LobStoreRAFile(database, lobBlockSize);
byteBuffer = new byte[lobBlockSize];
} else {
lobStore = new LobStoreMem(lobBlockSize);
byteBuffer = new byte[lobBlockSize];
}
}
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:15,代码来源:LobManager.java
示例16: setDBInfoArrays
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
/**
* Initialises the database attributes lists from the server properties object.
*/
private void setDBInfoArrays() {
IntKeyHashMap dbNumberMap = getDBNameArray();
int maxDatabases = dbNumberMap.size();
if (serverProperties.isPropertyTrue(
ServerProperties.sc_key_remote_open_db)) {
int max = serverProperties.getIntegerProperty(
ServerProperties.sc_key_max_databases,
ServerConstants.SC_DEFAULT_MAX_DATABASES);
if (maxDatabases < max) {
maxDatabases = max;
}
}
dbAlias = new String[maxDatabases];
dbPath = new String[dbAlias.length];
dbType = new String[dbAlias.length];
dbID = new int[dbAlias.length];
dbActionSequence = new long[dbAlias.length];
dbProps = new HsqlProperties[dbAlias.length];
Iterator it = dbNumberMap.keySet().iterator();
for (int i = 0; it.hasNext(); ) {
int dbNumber = it.nextInt();
String path = getDatabasePath(dbNumber, true);
if (path == null) {
printWithThread("missing database path: "
+ dbNumberMap.get(dbNumber));
continue;
}
HsqlProperties dbURL = DatabaseURL.parseURL(path, false, false);
if (dbURL == null) {
printWithThread("malformed database path: " + path);
continue;
}
dbAlias[i] = (String) dbNumberMap.get(dbNumber);
dbPath[i] = dbURL.getProperty("database");
dbType[i] = dbURL.getProperty("connection_type");
dbProps[i] = dbURL;
i++;
}
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:56,代码来源:Server.java
示例17: load
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
/**
* Creates file with defaults if it didn't exist.
* Returns false if file already existed.
*/
public boolean load() {
boolean exists;
if (!DatabaseURL.isFileBasedDatabaseType(database.getType())) {
return true;
}
try {
exists = super.load();
} catch (Exception e) {
throw Error.error(ErrorCode.FILE_IO_ERROR,
ErrorCode.M_LOAD_SAVE_PROPERTIES, new Object[] {
fileName, e
});
}
if (!exists) {
return false;
}
filterLoadedProperties();
String version = getProperty(hsqldb_compatible_version);
// do not open if the database belongs to a later (future) version
int check = version.substring(0, 5).compareTo(THIS_VERSION);
if (check > 0) {
throw Error.error(ErrorCode.WRONG_DATABASE_FILE_VERSION);
}
version = getProperty(db_version);
if (version.charAt(2) == '6') {
setProperty(hsqldb_cache_version, "1.6.0");
}
JavaSystem.gcFrequency = getIntegerProperty(runtime_gc_interval, 0);
return true;
}
开发者ID:s-store,项目名称:sstore-soft,代码行数:47,代码来源:HsqlDatabaseProperties.java
示例18: JDBCConnection
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
/**
* Constructs a new external <code>Connection</code> to an HSQLDB
* <code>Database</code>. <p>
*
* This constructor is called on behalf of the
* <code>java.sql.DriverManager</code> when getting a
* <code>Connection</code> for use in normal (external)
* client code. <p>
*
* Internal client code, that being code located in HSQLDB SQL
* functions and stored procedures, receives an INTERNAL
* connection constructed by the {@link
* #JDBCConnection(org.hsqldb.SessionInterface)
* JDBCConnection(SessionInterface)} constructor. <p>
*
* @param props A <code>Properties</code> object containing the connection
* properties
* @exception SQLException when the user/password combination is
* invalid, the connection url is invalid, or the
* <code>Database</code> is unavailable. <p>
*
* The <code>Database</code> may be unavailable for a number
* of reasons, including network problems or the fact that it
* may already be in use by another process.
*/
public JDBCConnection(HsqlProperties props) throws SQLException {
String user = props.getProperty("user");
String password = props.getProperty("password");
String connType = props.getProperty("connection_type");
String host = props.getProperty("host");
int port = props.getIntegerProperty("port", 0);
String path = props.getProperty("path");
String database = props.getProperty("database");
boolean isTLS = (connType == DatabaseURL.S_HSQLS
|| connType == DatabaseURL.S_HTTPS);
if (user == null) {
user = "SA";
}
if (password == null) {
password = "";
}
Calendar cal = Calendar.getInstance();
int zoneSeconds = HsqlDateTime.getZoneSeconds(cal);
try {
if (DatabaseURL.isInProcessDatabaseType(connType)) {
/**
* @todo fredt - this should be the only static reference to a core class in
* the jdbc package - we may make it dynamic
*/
sessionProxy = DatabaseManager.newSession(connType, database,
user, password, props, zoneSeconds);
} else { // alias: type not yet implemented
throw Util.invalidArgument(connType);
}
connProperties = props;
} catch (HsqlException e) {
throw Util.sqlException(e);
}
}
开发者ID:s-store,项目名称:sstore-soft,代码行数:66,代码来源:JDBCConnection.java
示例19: getSecurePath
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
/**
* Returns a secure path or null for a user-defined path when
* hsqldb.allow_full_path is false. Returns the path otherwise.
*
*/
public String getSecurePath(String path, boolean allowFull,
boolean includeRes) {
if (database.getType() == DatabaseURL.S_RES) {
if (includeRes) {
return path;
} else {
return null;
}
}
if (database.getType() == DatabaseURL.S_MEM) {
if (propTextAllowFullPath) {
return path;
} else {
return null;
}
}
// absolute paths
if (path.startsWith("/") || path.startsWith("\\")
|| path.indexOf(":") > -1) {
if (allowFull || propTextAllowFullPath) {
return path;
} else {
return null;
}
}
if (path.indexOf("..") > -1) {
if (allowFull || propTextAllowFullPath) {
// allow
} else {
return null;
}
}
String fullPath =
new File(new File(database.getPath()
+ ".properties").getAbsolutePath()).getParent();
if (fullPath != null) {
path = fullPath + File.separator + path;
}
return path;
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:54,代码来源:Logger.java
示例20: load
import org.hsqldb.DatabaseURL; //导入依赖的package包/类
/**
* Creates file with defaults if it didn't exist.
* Returns false if file already existed.
*/
public boolean load() {
boolean exists;
if (!DatabaseURL.isFileBasedDatabaseType(database.getType())) {
return true;
}
try {
exists = super.load();
} catch (Throwable t) {
throw Error.error(t, ErrorCode.FILE_IO_ERROR,
ErrorCode.M_LOAD_SAVE_PROPERTIES, new Object[] {
t.toString(), fileName
});
}
if (!exists) {
return false;
}
filterLoadedProperties();
String version = getStringProperty(hsqldb_version);
int check = version.substring(0, 5).compareTo(VERSION_STRING_1_8_0);
// do not open early version databases
if (check < 0) {
throw Error.error(ErrorCode.WRONG_DATABASE_FILE_VERSION);
}
// do not open databases of 1.8 versions if script format is not compatible
if (check == 0) {
if (getIntegerProperty(hsqldb_script_format) != 0) {
throw Error.error(ErrorCode.WRONG_DATABASE_FILE_VERSION);
}
}
check = version.substring(0, 2).compareTo(THIS_VERSION);
// do not open if the database belongs to a later (future) version (3.x)
if (check > 0) {
throw Error.error(ErrorCode.WRONG_DATABASE_FILE_VERSION);
}
return true;
}
开发者ID:Julien35,项目名称:dev-courses,代码行数:52,代码来源:HsqlDatabaseProperties.java
注:本文中的org.hsqldb.DatabaseURL类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论