Search in sources :

Example 6 with SDBExceptionSQL

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

the class FmtLayout2IndexDerby method formatTableNodes.

@Override
protected void formatTableNodes() {
    dropTable(TableDescNodes.name());
    try {
        connection().exec(sqlStr("CREATE TABLE " + TableDescNodes.name() + " (", "   id int generated always as identity ,", "   hash BIGINT NOT NULL ,", "   lex CLOB NOT NULL ,", "   lang LONG VARCHAR NOT NULL ,", "   datatype varchar(" + TableDescNodes.DatatypeUriLength + ") NOT NULL ,", "   type integer NOT NULL ,", "   PRIMARY KEY (id)", ")"));
        connection().exec("CREATE UNIQUE INDEX Hash ON " + TableDescNodes.name() + " (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 7 with SDBExceptionSQL

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

the class FmtLayout2IndexDerby method formatTableQuads.

@Override
protected void formatTableQuads() {
    TableDescQuads desc = new TableDescQuads();
    dropTable(desc.getTableName());
    try {
        String x = sqlStr("CREATE TABLE %s (", "    %2$s int NOT NULL,", "    %3$s int NOT NULL,", "    %4$s int NOT NULL,", "    %5$s int NOT NULL,", "    PRIMARY KEY (%2$s, %3$s, %4$s, %5$s)", ")");
        x = String.format(x, desc.getTableName(), desc.getGraphColName(), desc.getSubjectColName(), desc.getPredicateColName(), desc.getObjectColName());
        connection().exec(sqlStr("CREATE TABLE " + desc.getTableName() + " (", "    g int NOT NULL,", "    s int NOT NULL,", "    p int NOT NULL,", "    o int NOT NULL,", "    PRIMARY KEY (g, s, p, o)", ")"));
    } catch (SQLException ex) {
        throw new SDBExceptionSQL("SQLException formatting table '" + TableDescTriples.name() + "'", ex);
    }
}
Also used : TableDescQuads(org.apache.jena.sdb.layout2.TableDescQuads) SDBExceptionSQL(org.apache.jena.sdb.sql.SDBExceptionSQL) SQLException(java.sql.SQLException)

Example 8 with SDBExceptionSQL

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

the class FmtLayout2IndexH2 method formatTableNodes.

@Override
protected void formatTableNodes() {
    dropTable(TableDescNodes.name());
    try {
        connection().exec(sqlStr("CREATE TABLE " + TableDescNodes.name() + " (", "   id SERIAL,", "   hash BIGINT NOT NULL,", "   lex CLOB NOT NULL,", "   lang varchar NOT NULL default '',", "   datatype varchar(" + TableDescNodes.DatatypeUriLength + ") NOT NULL default '',", "   type integer NOT NULL default '0',", "   PRIMARY KEY (id)", ")"));
        connection().exec("CREATE UNIQUE INDEX Hash ON " + TableDescNodes.name() + " (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 9 with SDBExceptionSQL

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

the class FmtLayout2IndexHSQL method formatTableNodes.

@Override
protected void formatTableNodes() {
    dropTable(TableDescNodes.name());
    try {
        connection().exec(sqlStr("CREATE TABLE " + TableDescNodes.name() + " (", "   id INT IDENTITY ,", "   hash BIGINT NOT NULL ,", "   lex VARCHAR NOT NULL ,", "   lang VARCHAR(10) default '' NOT NULL ,", "   datatype VARCHAR default '' NOT NULL ,", "   type int default 0 NOT NULL ,", "   PRIMARY KEY (id)", ")"));
        connection().exec("CREATE UNIQUE INDEX Hash ON " + TableDescNodes.name() + " (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 10 with SDBExceptionSQL

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

the class FmtLayout2HashH2 method formatTableQuads.

@Override
protected void formatTableQuads() {
    String tname = TableDescQuads.name();
    dropTable(tname);
    try {
        connection().exec(sqlStr("CREATE TABLE " + tname + " (", "    g BIGINT NOT NULL,", "    s BIGINT NOT NULL,", "    p BIGINT NOT NULL,", "    o BIGINT NOT NULL,", "    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)

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