Examples of runUpdate()


Examples of com.j256.ormlite.support.CompiledStatement.runUpdate()

    }
    CompiledStatement compiledStatement =
        connection.compileStatement(statement, StatementType.UPDATE, noFieldTypes);
    try {
      assignStatementArguments(compiledStatement, arguments);
      return compiledStatement.runUpdate();
    } finally {
      compiledStatement.close();
    }
  }
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runUpdate()

   * Update rows in the database.
   */
  public int update(DatabaseConnection databaseConnection, PreparedUpdate<T> preparedUpdate) throws SQLException {
    CompiledStatement stmt = preparedUpdate.compile(databaseConnection);
    try {
      return stmt.runUpdate();
    } finally {
      if (stmt != null) {
        stmt.close();
      }
    }
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runUpdate()

   * Delete rows that match the prepared statement.
   */
  public int delete(DatabaseConnection databaseConnection, PreparedDelete<T> preparedDelete) throws SQLException {
    CompiledStatement stmt = preparedDelete.compile(databaseConnection);
    try {
      return stmt.runUpdate();
    } finally {
      if (stmt != null) {
        stmt.close();
      }
    }
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runUpdate()

    for (String statement : statements) {
      int rowC = 0;
      CompiledStatement compiledStmt = null;
      try {
        compiledStmt = connection.compileStatement(statement, StatementType.EXECUTE, noFieldTypes);
        rowC = compiledStmt.runUpdate();
        logger.info("executed {} table statement changed {} rows: {}", label, rowC, statement);
      } catch (SQLException e) {
        if (ignoreErrors) {
          logger.info("ignoring {} error '{}' for statement: {}", label, e.getMessage(), statement);
        } else {
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runUpdate()

    DatabaseConnection connection = createMock(DatabaseConnection.class);
    @SuppressWarnings("unchecked")
    PreparedUpdate<Foo> update = createMock(PreparedUpdate.class);
    CompiledStatement compiledStmt = createMock(CompiledStatement.class);
    expect(update.compile(connection)).andReturn(compiledStmt);
    expect(compiledStmt.runUpdate()).andThrow(new SQLException("expected"));
    compiledStmt.close();
    StatementExecutor<Foo, String> statementExec =
        new StatementExecutor<Foo, String>(databaseType, tableInfo, null);
    replay(connection, compiledStmt, update);
    try {
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runUpdate()

    DatabaseConnection connection = createMock(DatabaseConnection.class);
    @SuppressWarnings("unchecked")
    PreparedDelete<Foo> delete = createMock(PreparedDelete.class);
    CompiledStatement compiledStmt = createMock(CompiledStatement.class);
    expect(delete.compile(connection)).andReturn(compiledStmt);
    expect(compiledStmt.runUpdate()).andThrow(new SQLException("expected"));
    compiledStmt.close();
    StatementExecutor<Foo, String> statementExec =
        new StatementExecutor<Foo, String>(databaseType, tableInfo, null);
    replay(connection, compiledStmt, delete);
    try {
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runUpdate()

            assertEquals(StatementType.EXECUTE, args[1]);
            assertEquals(0, ((FieldType[]) args[2]).length);
            return stmt;
          }
        }).anyTimes();
    expect(stmt.runUpdate()).andReturn(0).anyTimes();
    connectionSource.releaseConnection(conn);
    expectLastCall().anyTimes();
    stmt.close();
    expectLastCall().anyTimes();
    replay(connectionSource, conn, stmt);
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runUpdate()

            assertEquals(0, ((FieldType[]) args[2]).length);
            return stmt;
          }
        })
        .anyTimes();
    expect(stmt.runUpdate()).andReturn(0).anyTimes();
    connectionSource.releaseConnection(conn);
    expectLastCall().anyTimes();
    stmt.close();
    expectLastCall().anyTimes();
    replay(connectionSource, conn, stmt);
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runUpdate()

      expect(conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class))).andThrow(
          new SQLException("you asked us to!!"));
    } else {
      expect(conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class))).andReturn(
          stmt);
      expect(stmt.runUpdate()).andReturn(rowN);
      stmt.close();
      if (queryAfter != null) {
        expect(conn.compileStatement(isA(String.class), isA(StatementType.class), isA(FieldType[].class))).andReturn(
            stmt);
        results = createMock(DatabaseResults.class);
View Full Code Here

Examples of com.j256.ormlite.support.CompiledStatement.runUpdate()

    DatabaseConnection connection = createMock(DatabaseConnection.class);
    @SuppressWarnings("unchecked")
    PreparedUpdate<Foo> update = createMock(PreparedUpdate.class);
    CompiledStatement compiledStmt = createMock(CompiledStatement.class);
    expect(update.compile(connection, StatementType.UPDATE)).andReturn(compiledStmt);
    expect(compiledStmt.runUpdate()).andThrow(new SQLException("expected"));
    compiledStmt.close();
    StatementExecutor<Foo, String> statementExec =
        new StatementExecutor<Foo, String>(databaseType, tableInfo, null);
    replay(connection, compiledStmt, update);
    try {
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.