Package com.hp.hpl.jena.sdb.sql

Examples of com.hp.hpl.jena.sdb.sql.ResultSetJDBC


            datatype = node.getLiteralDatatypeURI();
            if (datatype == null)
                datatype = "";
        }
       
        ResultSetJDBC rsx = null ;
        long hash = NodeLayout2.hash(lex, lang, datatype, typeId) ;
        try
        {
            rsx = connection.exec("SELECT COUNT(*) FROM " + tableDescQuads.getTableName() + " WHERE g = " + hash) ;
            ResultSet res = rsx.get() ;
            res.next() ;
            long result = res.getLong(1) ;
            return result ;
        } catch (SQLException e)
        {
View Full Code Here


   
    // -------- 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") ;
View Full Code Here

        }
    }

    private String readFromPrefixMap(String prefix)
    {
        ResultSetJDBC rsx = null ;
        try {
            String sqlStmt = sqlStr(
                "SELECT uri FROM "+prefixTableName,
                "   WHERE prefix = "+quoteStr(prefix)
                ) ;
            rsx = connection.execQuery(sqlStmt) ;
            ResultSet rs = rsx.get() ;
            String uri = null ;
            while(rs.next())
            {
                String v = rs.getString("uri") ;
                uri = v ;
View Full Code Here

            try { fetchSize = Integer.parseInt(str) ; }
            catch (NumberFormatException ex)
            { log.warn("Bad number for fetch size: "+str) ; }
       
        try {
            ResultSetJDBC jdbcResultSet = request.getStore().getConnection().execQuery(sqlStmtStr, fetchSize) ;
            try {
                // And check this is called once per SQL.
                if ( opSQL.getBridge() == null )
                    log.error("Null bridge") ;
                return opSQL.getBridge().assembleResults(jdbcResultSet, binding, execCxt) ;
View Full Code Here

    {
        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;
View Full Code Here

        if ( sqlStmt.startsWith("@") )
            sqlStmt = FileManager.get().readWholeFileAsUTF8(sqlStmt.substring(1)) ;
       
        getModTime().startTimer() ;
        long queryTime = 0 ;
        ResultSetJDBC rs = null ;
        try {
            rs = getModStore().getConnection().exec(sqlStmt) ;
            queryTime = getModTime().readTimer() ;
           
            if ( rs == null )
                System.out.println("Executed with no errors or results") ;
            else
            {
                if ( isQuiet() )
                    RS.consume(rs.get()) ;
                else
                    RS.printResultSet(rs.get()) ;
            }
        } catch (SQLException ex)
        {
            System.err.println("SQL Exception: "+ex.getMessage()) ;
            throw new TerminationException(9) ;
View Full Code Here

        }
    }
   
    private static TableDesc getDesc(Store store, String tableName)
    {
        ResultSetJDBC tableData = null ;
        List<String> colVars = new ArrayList<String>() ;
        try
        {
            // Need to portable get the column names.
            tableData = store.getConnection().execQuery("SELECT * FROM " + tableName) ;
            java.sql.ResultSetMetaData meta = tableData.get().getMetaData() ;
            int N = meta.getColumnCount() ;
            for (int i = 1; i <= N; i++)
            {
                String colName = meta.getColumnName(i) ;
                colVars.add(colName) ;
View Full Code Here

        b.build() ;

        try {
            String sqlStr = store.getSQLGenerator().generateSQL(request, b.getSqlNode()) ;
            //System.out.println(sqlStr) ;
            ResultSetJDBC tableData = store.getConnection().execQuery(sqlStr) ;
            ExecutionContext execCxt = new ExecutionContext(new Context(), null, null, null) ;
            return b.assembleResults(tableData, BindingRoot.create(), execCxt) ;
        } catch (SQLException ex)
        { throw new SDBExceptionSQL(ex) ; }
    }
View Full Code Here

        long hash = NodeLayout2.hash(node) ;
        String lex  = NodeLayout2.nodeToLex(node) ;
        String hashStr = Long.toString(hash) ;
        String sqlStmt = "SELECT id FROM Nodes WHERE hash = "+hashStr ;
       
        ResultSetJDBC rsx = null ;
        try {
            rsx = conn.execQuery(sqlStmt) ;
            ResultSet rs = rsx.get();
            if ( ! rs.next() )
            {
                if ( ! create )
                    throw new SDBException("No such node in table: "+node) ;
                insertNode(conn, lex, node) ;
View Full Code Here

            datatype = node.getLiteralDatatypeURI();
            if (datatype == null)
                datatype = "";
        }

        ResultSetJDBC rsx = null ;
        long hash = NodeLayout2.hash(lex, lang, datatype, typeId) ;
        try
        {
            rsx = connection.exec("SELECT id FROM Nodes WHERE hash = " + hash) ;
            ResultSet res = rsx.get() ;
            int id = -1 ;
            if (res.next())
                id = res.getInt(1) ;
            else
                // no graph, size == 0
                return 0 ;
            rsx.close();
            rsx = connection.exec("SELECT COUNT(*) FROM " + tableDescQuads.getTableName() + " WHERE g = " + id) ;
            res = rsx.get() ;
            res.next() ;
            long result = res.getLong(1) ;
            return result ;
        } catch (SQLException e)
        {
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sdb.sql.ResultSetJDBC

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.