Search in sources :

Example 46 with SDBExceptionSQL

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

the class FmtLayout2IndexSAP method formatTableQuads.

@Override
protected void formatTableQuads() {
    dropTable(TableDescQuads.name());
    try {
        connection().exec(sqlStr("CREATE " + storageType.getStorageName() + " TABLE " + TableDescQuads.name() + " (", "    g integer NOT NULL,", "    s integer NOT NULL,", "    p integer NOT NULL,", "    o integer NOT NULL", ")"));
        connection().exec(sqlStr("ALTER TABLE " + TableDescQuads.name() + " 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 47 with SDBExceptionSQL

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

the class FmtLayout2IndexSQLServer method formatTableNodes.

@Override
protected void formatTableNodes() {
    dropTable(TableDescNodes.name());
    try {
        connection().exec(sqlStr("CREATE TABLE " + TableDescNodes.name() + " (", "   id INT IDENTITY (1, 1) NOT NULL ,", "   hash BIGINT NOT NULL,", // NVARCHAR(max) better but not in SQL Server 2000
        "   lex NTEXT NOT NULL,", "   lang NVARCHAR(10) NOT NULL DEFAULT '',", "   datatype NVARCHAR(" + TableDescNodes.DatatypeUriLength + ") NOT NULL default '',", "   type INT 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)

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