Package org.voltdb

Examples of org.voltdb.SQLStmt


     */
    public void testReplicatedInsert() throws Exception {
        Object params[] = new Object[]{ 9999, "FUCK", "YO", "COUCH" };
        Procedure proc = this.getProcedure("InsertCountry");
        Statement stmt = CollectionUtil.first(proc.getStatements());
        this.batch = new SQLStmt[]{ new SQLStmt(stmt) };
        this.args = new ParameterSet[]{ new ParameterSet(params) };
       
        BatchPlanner planner = new BatchPlanner(batch, catalog_proc, p_estimator);
        this.touched_partitions.clear();
        PartitionSet partitions = catalogContext.getPartitionSetSingleton(BASE_PARTITION);
View Full Code Here


        // belong to the Procedure
        this.batch = new SQLStmt[1];
        this.args = new ParameterSet[1];
        int stmtCounters[] = { 0 };
        for (Statement catalog_stmt : catalog_proc.getStatements()) {
            this.batch[0] = new SQLStmt(catalog_stmt);
            this.args[0] = new ParameterSet(this.randomStatementParameters(catalog_stmt));
            this.planner = new BatchPlanner(this.batch, this.catalog_proc, p_estimator);
            this.touched_partitions.clear();
            BatchPlan plan = this.getPlan();
       
View Full Code Here

        // Create a big batch and make sure that the fragments are in the correct order
        Statement stmts[] = new Statement[]{
            catalog_proc.getStatements().getIgnoreCase("ReplicatedInsert"),
            catalog_proc.getStatements().getIgnoreCase("ReplicatedSelect")
        };
        SQLStmt batch[] = new SQLStmt[stmts.length];
        ParameterSet params[] = new ParameterSet[stmts.length];
        int stmtCounters[] = new int[stmts.length];
        for (int i = 0; i < stmts.length; i++) {
            batch[i] = new SQLStmt(stmts[i]);
            params[i] = new ParameterSet(this.randomStatementParameters(stmts[i]));
            stmtCounters[i] = i;
        } // FOR
       
        BatchPlanner planner = new BatchPlanner(batch, catalog_proc, p_estimator);
View Full Code Here

            // Skip the INSERT query because that's the only one where
            // the partitioning parameter actually matters
            if (stmt.getQuerytype() == QueryType.INSERT.getValue()) continue;
           
            Object params[] = this.randomStatementParameters(stmt);
            this.batch[i] = new SQLStmt(stmt);
            this.args[i] = new ParameterSet(params);
            i += 1;
        } // FOR
       
        this.planner = new BatchPlanner(this.batch, proc, p_estimator);
View Full Code Here

        assertNotNull(this.catalog_stmt);
        assertTrue(this.catalog_stmt.fullName(), this.catalog_stmt.getHas_singlesited());
        CatalogMap<PlanFragment> fragments = this.catalog_stmt.getFragments();

        // Create a SQLStmt batch
        this.batch = new SQLStmt[] { new SQLStmt(this.catalog_stmt, fragments) };
        this.args = new ParameterSet[] { VoltProcedure.getCleanParams(this.batch[0], raw_args) };
        this.stmtCounters = new int[]{ 0 };
    }
View Full Code Here

        this.batch = new SQLStmt[this.catalog_proc.getStatements().size()];
        this.args = new ParameterSet[this.batch.length];
        this.stmtCounters = new int[this.batch.length];
        int i = 0;
        for (Statement catalog_stmt : this.catalog_proc.getStatements()) {
            this.batch[i] = new SQLStmt(catalog_stmt);
            this.args[i] = ParameterSet.EMPTY;
            this.stmtCounters[i] = i;
            i++;
        } // FOR
View Full Code Here

        // iterate through the fields and deal with
        Field[] fields = procClass.getFields();
        for (Field f : fields) {
            if (f.getType() == SQLStmt.class) {
                // String fieldName = f.getName();
                SQLStmt stmt = null;

                try {
                    stmt = (SQLStmt) f.get(procInstance);
                } catch (IllegalArgumentException e) {
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }

                // add the statement to the catalog
                Statement catalogStmt = procedure.getStatements().add(f.getName());
               
                // compile the statement
                try {
                    StatementCompiler.compile(compiler, hsql, catalog, db, estimates, catalogStmt, stmt.getText(), info.singlePartition);
                } catch (VoltCompiler.VoltCompilerException e) {
                    e.printStackTrace();
                    String msg = shortName + "." + f.getName() + ": " + e.getMessage();
                    throw compiler.new VoltCompilerException(msg);
                }
View Full Code Here

                             "mapped to a ProcParameter",
                                 catalog_stmt.fullName(), catalog_param.fullName()));
                        valid = false;
                    }
                } // FOR
                if (valid) prefetchStmts.add(new SQLStmt(catalog_stmt));
            } // FOR
            if (prefetchStmts.isEmpty() == false) {
                stmt_ctr += prefetchStmts.size();
                proc_ctr++;
            } else {
View Full Code Here

                      ts, procParams));
       
        // Create a SQLStmt batch as if it was created during the normal txn execution process
        SQLStmt[] prefetchStmts = new SQLStmt[prefetchable.size()];
        for (int i = 0; i < prefetchStmts.length; ++i) {
            prefetchStmts[i] = new SQLStmt(prefetchable.get(i).statement);
        } // FOR
       
        // Use the StmtParameter mappings for the queries we
        // want to prefetch and extract the ProcParameters
        // to populate an array of ParameterSets to use as the batchArgs
View Full Code Here

            cresponse = volt_proc.call(ts, ts.getProcedureParameters().toArray()); // Blocking...
        // VoltProcedure.call() should handle any exceptions thrown by the transaction
        // If we get anything out here then that's bad news
        } catch (Throwable ex) {
            if (this.isShuttingDown() == false) {
                SQLStmt last[] = volt_proc.voltLastQueriesExecuted();
                LOG.fatal("Unexpected error while executing " + ts, ex);
                if (last.length > 0) {
                    LOG.fatal(String.format("Last Queries Executed [%d]: %s",
                              last.length, Arrays.toString(last)));
                }
View Full Code Here

TOP

Related Classes of org.voltdb.SQLStmt

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.