Codota Logo
JdbcTestUtils.deleteFromTableWhere
Code IndexAdd Codota to your IDE (free)

How to use
deleteFromTableWhere
method
in
org.springframework.test.jdbc.JdbcTestUtils

Best Java code snippets using org.springframework.test.jdbc.JdbcTestUtils.deleteFromTableWhere (Showing top 9 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-framework

/**
 * Convenience method for deleting all rows from the given table, using the
 * provided {@code WHERE} clause.
 * <p>Use with caution outside of a transaction!
 * <p>See the Javadoc for {@link JdbcTestUtils#deleteFromTableWhere} for details.
 * @param tableName the name of the table to delete rows from
 * @param whereClause the {@code WHERE} clause to append to the query
 * @param args arguments to bind to the query (leaving it to the {@code
 * PreparedStatement} to guess the corresponding SQL type); may also contain
 * {@link org.springframework.jdbc.core.SqlParameterValue SqlParameterValue}
 * objects which indicate not only the argument value but also the SQL type
 * and optionally the scale.
 * @return the number of rows deleted from the table
 * @since 4.0
 * @see JdbcTestUtils#deleteFromTableWhere
 */
protected int deleteFromTableWhere(String tableName, String whereClause, Object... args) {
  return JdbcTestUtils.deleteFromTableWhere(this.jdbcTemplate, tableName, whereClause, args);
}
origin: spring-projects/spring-framework

/**
 * Convenience method for deleting all rows from the given table, using the
 * provided {@code WHERE} clause.
 * <p>Use with caution outside of a transaction!
 * <p>See the Javadoc for {@link JdbcTestUtils#deleteFromTableWhere} for details.
 * @param tableName the name of the table to delete rows from
 * @param whereClause the {@code WHERE} clause to append to the query
 * @param args arguments to bind to the query (leaving it to the {@code
 * PreparedStatement} to guess the corresponding SQL type); may also contain
 * {@link org.springframework.jdbc.core.SqlParameterValue SqlParameterValue}
 * objects which indicate not only the argument value but also the SQL type
 * and optionally the scale.
 * @return the number of rows deleted from the table
 * @since 4.0
 * @see JdbcTestUtils#deleteFromTableWhere
 */
protected int deleteFromTableWhere(String tableName, String whereClause, Object... args) {
  return JdbcTestUtils.deleteFromTableWhere(this.jdbcTemplate, tableName, whereClause, args);
}
origin: spring-projects/spring-framework

@Test
public void deleteWithoutWhereClause() throws Exception {
  given(jdbcTemplate.update("DELETE FROM person")).willReturn(10);
  int deleted = JdbcTestUtils.deleteFromTableWhere(jdbcTemplate, "person", null);
  assertThat(deleted, equalTo(10));
}
origin: spring-projects/spring-framework

@Test
public void deleteWithWhereClauseAndArguments() throws Exception {
  given(jdbcTemplate.update("DELETE FROM person WHERE name = ? and age > ?", "Bob", 25)).willReturn(10);
  int deleted = JdbcTestUtils.deleteFromTableWhere(jdbcTemplate, "person", "name = ? and age > ?", "Bob", 25);
  assertThat(deleted, equalTo(10));
}
origin: spring-projects/spring-framework

@Test
public void deleteWithWhereClause() throws Exception {
  given(jdbcTemplate.update("DELETE FROM person WHERE name = 'Bob' and age > 25")).willReturn(10);
  int deleted = JdbcTestUtils.deleteFromTableWhere(jdbcTemplate, "person", "name = 'Bob' and age > 25");
  assertThat(deleted, equalTo(10));
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

/**
 * Convenience method for deleting all rows from the given table, using the
 * provided {@code WHERE} clause.
 * <p>Use with caution outside of a transaction!
 * <p>See the Javadoc for {@link JdbcTestUtils#deleteFromTableWhere} for details.
 * @param tableName the name of the table to delete rows from
 * @param whereClause the {@code WHERE} clause to append to the query
 * @param args arguments to bind to the query (leaving it to the {@code
 * PreparedStatement} to guess the corresponding SQL type); may also contain
 * {@link org.springframework.jdbc.core.SqlParameterValue SqlParameterValue}
 * objects which indicate not only the argument value but also the SQL type
 * and optionally the scale.
 * @return the number of rows deleted from the table
 * @since 4.0
 * @see JdbcTestUtils#deleteFromTableWhere
 */
protected int deleteFromTableWhere(String tableName, String whereClause, Object... args) {
  return JdbcTestUtils.deleteFromTableWhere(this.jdbcTemplate, tableName, whereClause, args);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

/**
 * Convenience method for deleting all rows from the given table, using the
 * provided {@code WHERE} clause.
 * <p>Use with caution outside of a transaction!
 * <p>See the Javadoc for {@link JdbcTestUtils#deleteFromTableWhere} for details.
 * @param tableName the name of the table to delete rows from
 * @param whereClause the {@code WHERE} clause to append to the query
 * @param args arguments to bind to the query (leaving it to the {@code
 * PreparedStatement} to guess the corresponding SQL type); may also contain
 * {@link org.springframework.jdbc.core.SqlParameterValue SqlParameterValue}
 * objects which indicate not only the argument value but also the SQL type
 * and optionally the scale.
 * @return the number of rows deleted from the table
 * @since 4.0
 * @see JdbcTestUtils#deleteFromTableWhere
 */
protected int deleteFromTableWhere(String tableName, String whereClause, Object... args) {
  return JdbcTestUtils.deleteFromTableWhere(this.jdbcTemplate, tableName, whereClause, args);
}
origin: apache/servicemix-bundles

/**
 * Convenience method for deleting all rows from the given table, using the
 * provided {@code WHERE} clause.
 * <p>Use with caution outside of a transaction!
 * <p>See the Javadoc for {@link JdbcTestUtils#deleteFromTableWhere} for details.
 * @param tableName the name of the table to delete rows from
 * @param whereClause the {@code WHERE} clause to append to the query
 * @param args arguments to bind to the query (leaving it to the {@code
 * PreparedStatement} to guess the corresponding SQL type); may also contain
 * {@link org.springframework.jdbc.core.SqlParameterValue SqlParameterValue}
 * objects which indicate not only the argument value but also the SQL type
 * and optionally the scale.
 * @return the number of rows deleted from the table
 * @since 4.0
 * @see JdbcTestUtils#deleteFromTableWhere
 */
protected int deleteFromTableWhere(String tableName, String whereClause, Object... args) {
  return JdbcTestUtils.deleteFromTableWhere(jdbcTemplate, tableName, whereClause, args);
}
origin: apache/servicemix-bundles

/**
 * Convenience method for deleting all rows from the given table, using the
 * provided {@code WHERE} clause.
 * <p>Use with caution outside of a transaction!
 * <p>See the Javadoc for {@link JdbcTestUtils#deleteFromTableWhere} for details.
 * @param tableName the name of the table to delete rows from
 * @param whereClause the {@code WHERE} clause to append to the query
 * @param args arguments to bind to the query (leaving it to the {@code
 * PreparedStatement} to guess the corresponding SQL type); may also contain
 * {@link org.springframework.jdbc.core.SqlParameterValue SqlParameterValue}
 * objects which indicate not only the argument value but also the SQL type
 * and optionally the scale.
 * @return the number of rows deleted from the table
 * @since 4.0
 * @see JdbcTestUtils#deleteFromTableWhere
 */
protected int deleteFromTableWhere(String tableName, String whereClause, Object... args) {
  return JdbcTestUtils.deleteFromTableWhere(jdbcTemplate, tableName, whereClause, args);
}
org.springframework.test.jdbcJdbcTestUtilsdeleteFromTableWhere

Javadoc

Delete rows from the given table, using the provided WHERE clause.

If the provided WHERE clause contains text, it will be prefixed with " WHERE " and then appended to the generated DELETEstatement. For example, if the provided table name is "person" and the provided where clause is "name = 'Bob' and age > 25", the resulting SQL statement to execute will be "DELETE FROM person WHERE name = 'Bob' and age > 25".

As an alternative to hard-coded values, the "?" placeholder can be used within the WHERE clause, binding to the given arguments.

Popular methods of JdbcTestUtils

  • countRowsInTable
    Count the rows in the given table.
  • deleteFromTables
    Delete all rows from the specified tables.
  • dropTables
    Drop the specified tables.
  • countRowsInTableWhere
    Count the rows in the given table, using the provided WHERE clause.If the provided WHERE clause cont
  • readScript
    Read a script from the provided LineNumberReader, using the supplied comment prefix, and build a Str
  • splitSqlScript
  • executeSqlScript
    Execute the given SQL script.The script will typically be loaded from the classpath. There should be

Popular in Java

  • Updating database using SQL prepared statement
  • compareTo (BigDecimal)
  • startActivity (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • JLabel (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now