Package java.sql

Examples of java.sql.Connection.prepareCall()


        stmt.setObject(1, new Integer[] { 1, 2 });
        rs = stmt.executeQuery();
        rs.next();
        assertEquals(Integer[].class.getName(), rs.getObject(1).getClass().getName());

        CallableStatement call = conn.prepareCall("{ ? = call array_test(?) }");
        call.setObject(2, new Integer[] { 2, 1 });
        call.registerOutParameter(1, Types.ARRAY);
        call.execute();
        assertEquals(Integer[].class.getName(), call.getArray(1).getArray().getClass().getName());
        assertEquals(new Integer[] { 2, 1 }, (Integer[]) call.getObject(1));
View Full Code Here


    Command command = TranslationHelper.helpTranslate(TranslationHelper.BQT_VDB, "exec pm2.spTest8a()"); //$NON-NLS-1$
    Connection connection = Mockito.mock(Connection.class);
    CallableStatement cs = Mockito.mock(CallableStatement.class);
    Mockito.stub(cs.getUpdateCount()).toReturn(-1);
    Mockito.stub(cs.getInt(1)).toReturn(5);
    Mockito.stub(connection.prepareCall("{  call spTest8a(?)}")).toReturn(cs); //$NON-NLS-1$
    JDBCExecutionFactory ef = new JDBCExecutionFactory();
   
    JDBCProcedureExecution procedureExecution = new JDBCProcedureExecution(command, connection, Mockito.mock(ExecutionContext.class),  ef);
    procedureExecution.execute();
    assertEquals(Arrays.asList(5), procedureExecution.getOutputParameterValues());
View Full Code Here

    Command command = TranslationHelper.helpTranslate(TranslationHelper.BQT_VDB, "exec pm2.spTest8(1)"); //$NON-NLS-1$
    Connection connection = Mockito.mock(Connection.class);
    CallableStatement cs = Mockito.mock(CallableStatement.class);
    Mockito.stub(cs.getUpdateCount()).toReturn(-1);
    Mockito.stub(cs.getInt(2)).toReturn(5);
    Mockito.stub(connection.prepareCall("{  call spTest8(?,?)}")).toReturn(cs); //$NON-NLS-1$
    JDBCExecutionFactory config = new JDBCExecutionFactory();

    JDBCProcedureExecution procedureExecution = new JDBCProcedureExecution(command, connection, Mockito.mock(ExecutionContext.class), config);
    procedureExecution.execute();
    assertEquals(Arrays.asList(5), procedureExecution.getOutputParameterValues());
View Full Code Here

        DeleteDbFiles.execute("memFS:", "lob", true);
        Connection conn = org.h2.Driver.load().connect("jdbc:h2:memFS:lob", null);
        Statement stat = conn.createStatement();
        stat.execute("create table test(d blob)");
        stat.execute("set MAX_LENGTH_INPLACE_LOB 1");
        PreparedStatement prep = conn.prepareCall("insert into test values('0000')");
        // long start = System.currentTimeMillis();
        for (int i = 0; i < 2000; i++) {
            // if (i % 1000 == 0) {
            //     long now = System.currentTimeMillis();
            //     System.out.println(i + " " + (now - start));
View Full Code Here

  public Any m_call(Context context, String query)
  {
    Connection conn = null;
    try {
      conn = getConnection();
      CallableStatement stmt = conn.prepareCall(query);
      return new AnyStatement(stmt);
    } catch (SQLException e) {
      if (conn != null) {
        try {
          conn.close();
View Full Code Here

         }

         {
            sql = "{? = call " + this.replPrefix + "check_tables(?,?,?,?,NULL)}"; // name text, content text)
            try {
               CallableStatement st = conn.prepareCall(sql);
               st.setString(2, "dbName");    // database name
               st.setString(3, "schema");
               st.setString(4, "table");
               st.setString(5, "COMMAND");
               st.registerOutParameter(1, Types.VARCHAR);
View Full Code Here

         }

         {
            sql = "{? = call " + this.replPrefix + "check_tables(?,?,?,?,?)}"; // name text, content text)
            try {
               CallableStatement st = conn.prepareCall(sql);
               st.setString(2, "dbName");    // database name
               st.setString(3, "schema");
               st.setString(4, "table");
               st.setString(5, "COMMAND");
               st.setString(6, "TEST CONTENT");
View Full Code Here

                  this.pool.update("DELETE FROM " + "TEST_REPLICATION");
               }
               catch (Exception e) {
               }

               CallableStatement st = conn.prepareCall(sql);
               st.setString(2, null);
               st.setString(3, this.specificHelper.getOwnSchema(this.pool));
               st.setString(4, "TEST_REPLICATION");
               st.setString(5, "CREATE");
               st.registerOutParameter(1, Types.VARCHAR);
View Full Code Here

               boolean forceSend = false;
               TableToWatchInfo tableToWatch = new TableToWatchInfo(null, this.specificHelper.getOwnSchema(this.pool), "TEST_REPLICATION");
               tableToWatch.setActions("");
               tableToWatch.setTrigger(null);
               this.dbSpecific.addTableToWatch(tableToWatch, force, null, forceSend);
               CallableStatement st = conn.prepareCall(sql);
               st.setString(2, null);
               st.setString(3, this.specificHelper.getOwnSchema(this.pool));
               st.setString(4, "TEST_REPLICATION");
               st.setString(5, "CREATE");
               st.registerOutParameter(1, Types.VARCHAR);
View Full Code Here

         conn.setAutoCommit(true);
         String sql = null;
         {
          // col2xml_cdata(?, ?)
            sql = "{? = call " + this.replPrefix + "test_clob(?,?,?,?)}"; // name text, content text)
            CallableStatement st = conn.prepareCall(sql);
            st.setString(2, "COL2XML_CDATA");
            st.setString(3, "prova");
            st.setString(4, "test");
            st.setLong(5, 1L); // loop only once
            st.registerOutParameter(1, Types.CLOB);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.