congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
JdbcTestUtils
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: spring-projects/spring-framework

/**
 * Convenience method for counting the rows in the given table.
 * @param tableName table name to count rows in
 * @return the number of rows in the table
 * @see JdbcTestUtils#countRowsInTable
 */
protected int countRowsInTable(String tableName) {
  return JdbcTestUtils.countRowsInTable(this.jdbcTemplate, tableName);
}
origin: spring-projects/spring-framework

/**
 * Convenience method for deleting all rows from the specified tables.
 * <p>Use with caution outside of a transaction!
 * @param names the names of the tables from which to delete
 * @return the total number of rows deleted from all specified tables
 * @see JdbcTestUtils#deleteFromTables
 */
protected int deleteFromTables(String... names) {
  return JdbcTestUtils.deleteFromTables(this.jdbcTemplate, names);
}
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 dropping all of the specified tables.
 * <p>Use with caution outside of a transaction!
 * @param names the names of the tables to drop
 * @since 3.2
 * @see JdbcTestUtils#dropTables
 */
protected void dropTables(String... names) {
  JdbcTestUtils.dropTables(this.jdbcTemplate, names);
}
origin: scottysinclair/barleydb

public static void executeScript(Connection con, String script, boolean continueOnError) throws Exception {
  LineNumberReader in = new LineNumberReader(new StringReader( script ));
  List<String> statements = new LinkedList<>();
  JdbcTestUtils.splitSqlScript(JdbcTestUtils.readScript(in), ';', statements);
  if (continueOnError){
    con.setAutoCommit(true);
origin: spring-projects/spring-framework

/**
 * Convenience method for counting the rows in the given table, using the
 * provided {@code WHERE} clause.
 * <p>See the Javadoc for {@link JdbcTestUtils#countRowsInTableWhere} for details.
 * @param tableName the name of the table to count rows in
 * @param whereClause the {@code WHERE} clause to append to the query
 * @return the number of rows in the table that match the provided
 * {@code WHERE} clause
 * @since 3.2
 * @see JdbcTestUtils#countRowsInTableWhere
 */
protected int countRowsInTableWhere(String tableName, String whereClause) {
  return JdbcTestUtils.countRowsInTableWhere(this.jdbcTemplate, tableName, whereClause);
}
origin: apache/servicemix-bundles

/**
 * Read a script from the provided {@code LineNumberReader}, using
 * "{@code --}" as the comment prefix, and build a {@code String} containing
 * the lines.
 * @param lineNumberReader the {@code LineNumberReader} containing the script
 * to be processed
 * @return a {@code String} containing the script lines
 * @see #readScript(LineNumberReader, String)
 * @deprecated as of Spring 4.0.3, in favor of using
 * {@link org.springframework.jdbc.datasource.init.ScriptUtils#readScript(LineNumberReader, String, String)}
 */
@Deprecated
public static String readScript(LineNumberReader lineNumberReader) throws IOException {
  return readScript(lineNumberReader, ScriptUtils.DEFAULT_COMMENT_PREFIX);
}
origin: spring-projects/spring-framework

/**
 * Convenience method for dropping all of the specified tables.
 * <p>Use with caution outside of a transaction!
 * @param names the names of the tables to drop
 * @since 3.2
 * @see JdbcTestUtils#dropTables
 */
protected void dropTables(String... names) {
  JdbcTestUtils.dropTables(this.jdbcTemplate, names);
}
origin: spring-projects/spring-framework

/**
 * Convenience method for counting the rows in the given table, using the
 * provided {@code WHERE} clause.
 * <p>See the Javadoc for {@link JdbcTestUtils#countRowsInTableWhere} for details.
 * @param tableName the name of the table to count rows in
 * @param whereClause the {@code WHERE} clause to append to the query
 * @return the number of rows in the table that match the provided
 * {@code WHERE} clause
 * @since 3.2
 * @see JdbcTestUtils#countRowsInTableWhere
 */
protected int countRowsInTableWhere(String tableName, String whereClause) {
  return JdbcTestUtils.countRowsInTableWhere(this.jdbcTemplate, tableName, whereClause);
}
origin: spring-projects/spring-framework

/**
 * Convenience method for counting the rows in the given table.
 * @param tableName table name to count rows in
 * @return the number of rows in the table
 * @see JdbcTestUtils#countRowsInTable
 */
protected int countRowsInTable(String tableName) {
  return JdbcTestUtils.countRowsInTable(this.jdbcTemplate, tableName);
}
origin: spring-projects/spring-framework

/**
 * Convenience method for deleting all rows from the specified tables.
 * <p>Use with caution outside of a transaction!
 * @param names the names of the tables from which to delete
 * @return the total number of rows deleted from all specified tables
 * @see JdbcTestUtils#deleteFromTables
 */
protected int deleteFromTables(String... names) {
  return JdbcTestUtils.deleteFromTables(this.jdbcTemplate, names);
}
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: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

/**
 * Convenience method for dropping all of the specified tables.
 * <p>Use with caution outside of a transaction!
 * @param names the names of the tables to drop
 * @since 3.2
 * @see JdbcTestUtils#dropTables
 */
protected void dropTables(String... names) {
  JdbcTestUtils.dropTables(this.jdbcTemplate, names);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

/**
 * Convenience method for counting the rows in the given table, using the
 * provided {@code WHERE} clause.
 * <p>See the Javadoc for {@link JdbcTestUtils#countRowsInTableWhere} for details.
 * @param tableName the name of the table to count rows in
 * @param whereClause the {@code WHERE} clause to append to the query
 * @return the number of rows in the table that match the provided
 * {@code WHERE} clause
 * @since 3.2
 * @see JdbcTestUtils#countRowsInTableWhere
 */
protected int countRowsInTableWhere(String tableName, String whereClause) {
  return JdbcTestUtils.countRowsInTableWhere(this.jdbcTemplate, tableName, whereClause);
}
origin: spring-projects/spring-framework

private int countRowsInTable(String tableName) {
  return JdbcTestUtils.countRowsInTable(this.jdbcTemplate, tableName);
}
origin: spring-projects/spring-framework

protected int deleteFromTables(String... names) {
  return JdbcTestUtils.deleteFromTables(this.jdbcTemplate, names);
}
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: apache/servicemix-bundles

/**
 * Convenience method for dropping all of the specified tables.
 * <p>Use with caution outside of a transaction!
 * @param names the names of the tables to drop
 * @since 3.2
 * @see JdbcTestUtils#dropTables
 */
protected void dropTables(String... names) {
  JdbcTestUtils.dropTables(this.jdbcTemplate, names);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-test

/**
 * Convenience method for counting the rows in the given table, using the
 * provided {@code WHERE} clause.
 * <p>See the Javadoc for {@link JdbcTestUtils#countRowsInTableWhere} for details.
 * @param tableName the name of the table to count rows in
 * @param whereClause the {@code WHERE} clause to append to the query
 * @return the number of rows in the table that match the provided
 * {@code WHERE} clause
 * @since 3.2
 * @see JdbcTestUtils#countRowsInTableWhere
 */
protected int countRowsInTableWhere(String tableName, String whereClause) {
  return JdbcTestUtils.countRowsInTableWhere(this.jdbcTemplate, tableName, whereClause);
}
origin: spring-projects/spring-framework

private int countRowsInTable(String tableName) {
  return JdbcTestUtils.countRowsInTable(this.jdbcTemplate, tableName);
}
org.springframework.test.jdbcJdbcTestUtils

Javadoc

JdbcTestUtils is a collection of JDBC related utility functions intended to simplify standard database testing scenarios.

Most used methods

  • countRowsInTable
    Count the rows in the given table.
  • deleteFromTables
    Delete all rows from the specified tables.
  • deleteFromTableWhere
    Delete rows from the given table, using the provided WHERE clause.If the provided WHERE clause conta
  • 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
  • getContentResolver (Context)
  • findViewById (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Collectors (java.util.stream)
  • JLabel (javax.swing)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now