use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.
the class PrefixMappingSDB method readPrefixMapping.
// Super class implementation loops and calls setNsPrefix calls set() for each entry.
//@Override
//public PrefixMapping setNsPrefixes(PrefixMapping arg0)
// Super class implementation will suffice.
// It (creates a map copy and) loops on each entry.
//@Override
//public PrefixMapping setNsPrefixes(Map arg0)
// -------- Worker implementations
private void readPrefixMapping() {
ResultSetJDBC rsx = null;
try {
String sqlStmt = "SELECT prefix, uri FROM " + prefixTableName;
rsx = connection.execSilent(sqlStmt);
if (rsx == null || rsx.get() == null)
return;
ResultSet rs = rsx.get();
while (rs.next()) {
String p = rs.getString("prefix");
p = decode(p);
String v = rs.getString("uri");
// Load in-memory copy.
super.set(p, v);
}
} catch (SQLException ex) {
throw new SDBExceptionSQL("Failed to get prefixes", ex);
} finally {
RS.close(rsx);
}
}
use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.
the class TransactionHandlerSDB method begin.
// Simplistic
@Override
public synchronized void begin() {
if (inTransaction) {
log.warn("beginTransaction: Already in a transaction");
throw new SDBException("Already in transaction");
}
try {
sqlConnection.setAutoCommit(false);
inTransaction = true;
} catch (SQLException ex) {
new SDBExceptionSQL("begin", ex);
}
}
use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.
the class TransactionHandlerSDB method abort.
@Override
public synchronized void abort() {
if (!inTransaction) {
log.warn("abort: Not in a transaction");
return;
}
try {
sqlConnection.rollback();
sqlConnection.setAutoCommit(true);
inTransaction = false;
} catch (SQLException ex) {
new SDBExceptionSQL("abort", ex);
}
}
use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.
the class FmtLayout2HashH2 method formatTablePrefixes.
@Override
protected void formatTablePrefixes() {
String tname = TablePrefixes.name();
dropTable(tname);
try {
connection().exec(sqlStr("CREATE TABLE " + tname + " (", " prefix VARCHAR(" + TablePrefixes.prefixColWidth + ") NOT NULL ,", " uri VARCHAR(" + TablePrefixes.uriColWidth + ") NOT NULL ,", " CONSTRAINT " + tname + "_PK PRIMARY KEY (prefix)", ")"));
} catch (SQLException ex) {
throw new SDBExceptionSQL("SQLException resetting table '" + TablePrefixes.name() + "'", ex);
}
}
use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.
the class FmtLayout2HashH2 method formatTableTriples.
@Override
protected void formatTableTriples() {
String tname = TableDescTriples.name();
dropTable(tname);
try {
connection().exec(sqlStr("CREATE TABLE " + tname + " (", " s BIGINT NOT NULL,", " p BIGINT NOT NULL,", " o BIGINT NOT NULL,", " PRIMARY KEY (s, p, o)", ")"));
} catch (SQLException ex) {
throw new SDBExceptionSQL("SQLException formatting table '" + TableDescTriples.name() + "'", ex);
}
}
Aggregations