Search in sources :

Example 36 with SDBExceptionSQL

use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.

the class FormatterSimplePGSQL method dropIndexes.

@Override
public void dropIndexes() {
    try {
        connection().exec("DROP INDEX IF EXISTS PredObj");
        connection().exec("DROP INDEX IF EXISTS ObjSubj");
    } catch (SQLException ex) {
        throw new SDBExceptionSQL("SQLException dropping indexes for table 'Triples'", ex);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Example 37 with SDBExceptionSQL

use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.

the class FormatterSimpleSAP method dropIndexes.

@Override
public void dropIndexes() {
    try {
        connection().exec("DROP INDEX IF EXISTS PredObj");
        connection().exec("DROP INDEX IF EXISTS ObjSubj");
    } catch (SQLException ex) {
        throw new SDBExceptionSQL("SQLException dropping indexes for table 'Triples'", ex);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Example 38 with SDBExceptionSQL

use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.

the class FormatterSimple method dropIndexes.

@Override
public void dropIndexes() {
    try {
        connection().exec("DROP INDEX PredObj");
        connection().exec("DROP INDEX ObjSubj");
    } catch (SQLException ex) {
        throw new SDBExceptionSQL("SQLException dropping indexes for table 'Triples'", ex);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Example 39 with SDBExceptionSQL

use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.

the class FormatterSimpleDB2 method dropIndexes.

@Override
public void dropIndexes() {
    try {
        connection().exec("DROP INDEX " + TableDescSPO.name() + ".SubjPred");
        connection().exec("DROP INDEX " + TableDescSPO.name() + ".PredObj");
        connection().exec("DROP INDEX " + TableDescSPO.name() + ".ObjSubj");
    } catch (SQLException ex) {
        throw new SDBExceptionSQL("SQLException dropping indexes for table 'Triples'", ex);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Example 40 with SDBExceptionSQL

use of org.apache.jena.sdb.sql.SDBExceptionSQL in project jena by apache.

the class TupleLoaderOne method entryExists.

protected boolean entryExists(String[] vals) {
    String rowValues = whereRow(vals);
    String selectTemplate = "SELECT count(*) FROM %s WHERE %s\n";
    String sqlStmt = String.format(selectTemplate, getTableName(), rowValues);
    ResultSetJDBC rs = null;
    try {
        rs = connection().execQuery(sqlStmt);
        rs.get().next();
        int count = rs.get().getInt(1);
        if (count > 0) {
            log.debug("Duplicate tuple detected: count=" + count + " :: " + vals);
            return true;
        }
        // Otherwise deos not exist
        return false;
    } catch (SQLException ex) {
        throw new SDBExceptionSQL(ex);
    } finally {
        RS.close(rs);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException) ResultSetJDBC(org.apache.jena.sdb.sql.ResultSetJDBC)

Aggregations

SQLException (java.sql.SQLException)47 SDBExceptionSQL (org.apache.jena.sdb.sql.SDBExceptionSQL)47 ResultSetJDBC (org.apache.jena.sdb.sql.ResultSetJDBC)8 ResultSet (java.sql.ResultSet)4 ArrayList (java.util.ArrayList)1 SDBException (org.apache.jena.sdb.SDBException)1 SDBRequest (org.apache.jena.sdb.core.SDBRequest)1 TableDescQuads (org.apache.jena.sdb.layout2.TableDescQuads)1 TableDescTriples (org.apache.jena.sdb.layout2.TableDescTriples)1 ExecutionContext (org.apache.jena.sparql.engine.ExecutionContext)1 Context (org.apache.jena.sparql.util.Context)1