Search in sources :

Example 16 with SDBExceptionSQL

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

the class FmtLayout2HashSAP method formatTableNodes.

@Override
protected void formatTableNodes() {
    String tname = TableDescNodes.name();
    dropTable(tname);
    try {
        connection().exec(sqlStr("CREATE " + storageType.getStorageName() + " TABLE " + tname + " (", "   hash BIGINT NOT NULL,", "   lex nvarchar(5000) NOT NULL,", "   lang nvarchar (10) NOT NULL default '',", "   datatype nvarchar(" + TableDescNodes.DatatypeUriLength + ") NOT NULL default '',", "   type integer NOT NULL default '0'", ")"));
        connection().exec(sqlStr("ALTER TABLE " + tname + " ADD PRIMARY KEY (hash)"));
    } catch (SQLException ex) {
        throw new SDBExceptionSQL("SQLException formatting table '" + TableDescNodes.name() + "'", ex);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Example 17 with SDBExceptionSQL

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

the class FmtLayout2HashSAP method formatTablePrefixes.

@Override
protected void formatTablePrefixes() {
    String tname = TablePrefixes.name();
    dropTable(tname);
    try {
        connection().exec(sqlStr("CREATE " + storageType.getStorageName() + " TABLE " + tname + " (", "    prefix NVARCHAR(" + TablePrefixes.prefixColWidth + ") NOT NULL ,", "    uri NVARCHAR(" + TablePrefixes.uriColWidth + ") NOT NULL", ")"));
        connection().exec(sqlStr("ALTER TABLE " + tname + " ADD CONSTRAINT " + tname + "_PK PRIMARY KEY (prefix)"));
    } catch (SQLException ex) {
        throw new SDBExceptionSQL("SQLException resetting table '" + TablePrefixes.name() + "'", ex);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Example 18 with SDBExceptionSQL

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

the class FmtLayout2HashSAP method formatTableTriples.

@Override
protected void formatTableTriples() {
    String tname = TableDescTriples.name();
    dropTable(tname);
    try {
        connection().exec(sqlStr("CREATE " + storageType.getStorageName() + " TABLE " + tname + " (", "    s BIGINT NOT NULL,", "    p BIGINT NOT NULL,", "    o BIGINT NOT NULL", ")"));
        connection().exec(sqlStr("ALTER TABLE " + tname + " ADD PRIMARY KEY (s, p, o)"));
    } catch (SQLException ex) {
        throw new SDBExceptionSQL("SQLException formatting table '" + TableDescTriples.name() + "'", ex);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Example 19 with SDBExceptionSQL

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

the class FmtLayout2HashSAP method formatTableQuads.

@Override
protected void formatTableQuads() {
    String tname = TableDescQuads.name();
    dropTable(tname);
    try {
        connection().exec(sqlStr("CREATE " + storageType.getStorageName() + " TABLE " + tname + " (", "    g BIGINT NOT NULL,", "    s BIGINT NOT NULL,", "    p BIGINT NOT NULL,", "    o BIGINT NOT NULL", ")"));
        connection().exec(sqlStr("ALTER TABLE " + tname + " ADD PRIMARY KEY (g, s, p, o)"));
    } catch (SQLException ex) {
        throw new SDBExceptionSQL("SQLException formatting table '" + TableDescTriples.name() + "'", ex);
    }
}
Also used : SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Example 20 with SDBExceptionSQL

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

the class FormatterSimpleOracle method dropIndexes.

@Override
public void dropIndexes() {
    try {
        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)

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