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

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


        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


        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

            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

        String sqlStmtTest = strjoinNL(
                "SELECT hash FROM "+TableDescNodes.name(),
                "WHERE hash = "+hash
                ) ;
       
        ResultSetJDBC rsx = null ;
        try {
            rsx = connection().execQuery(sqlStmtTest) ;
            ResultSet rs = rsx.get();
            boolean b = rs.next();
            if ( b )
                // Exists
                return new SqlConstant(hash) ;
        } finally { RS.close(rsx) ; }
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

        String sqlStmtTest = strjoinNL(
                "SELECT hash FROM "+TableDescNodes.name(),
                "WHERE hash = "+hash
                ) ;
       
        ResultSetJDBC rsx = null ;
        try {
            rsx = connection().execQuery(sqlStmtTest) ;
            ResultSet rs = rsx.get();
            boolean b = rs.next();
            if ( b )
                // Exists
                return new SqlConstant(hash) ;
        } finally { RS.close(rsx) ; }
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.