Codota Logo
AggregateOp
Code IndexAdd Codota to your IDE (free)

How to use
AggregateOp
in
com.novarto.sanedbc.core.ops

Best Java code snippets using com.novarto.sanedbc.core.ops.AggregateOp (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Charset c =
  • Codota IconString charsetName;Charset.forName(charsetName)
  • Codota IconCharset.defaultCharset()
  • Codota IconContentType contentType;contentType.getCharset()
  • Smart code suggestions by Codota
}
origin: novarto-oss/sane-dbc

public static DB<Long> count(String like)
{
  String searchQuery = like.trim();
  //an aggregate op expects the resultset to have one element, and that element to be cast to long
  //useful for numeric aggregate operations
  return new AggregateOp("SELECT COUNT(*) FROM STUFF WHERE LOWER(DESCRIPTION) LIKE LOWER(?)",
      ps -> ps.setString(1, searchQuery + "%")
  );
}
origin: novarto-oss/sane-dbc

@Test
public void rollback()
{
  DB<List<Long>> insertDataFail = insertKeysOp(list("okidoki")).bind(ids -> fail("failed i have"));
  swallow(() -> DB.transact(insertDataFail));
  DB<P2<Long, Long>> tryCounts = COUNT_IDS.bind(idCount -> COUNT_DATA.map(dataCount -> p(idCount, dataCount)));
  P2<Long, Long> counts = DB.submit(tryCounts);
  assertEquals(0, (long) counts._1());
  assertEquals(0, (long) counts._2());
}
origin: novarto-oss/sane-dbc

@Test
public void rollback2()
{
  DB<Unit> failedInsert = insertKeysOp(list("ok"))
      .bind(ids -> insertDataOp(ids.zip(list("description"))).bind(insertCount ->
      {
        throw new RuntimeException("failed I have");
      }));
  swallow(() -> DB.transact(failedInsert));
  DB<P2<Long, Long>> tryCounts = COUNT_IDS.bind(idCount -> COUNT_DATA.map(dataCount -> p(idCount, dataCount)));
  P2<Long, Long> counts = DB.submit(tryCounts);
  assertEquals(0, (long) counts._1());
  assertEquals(0, (long) counts._2());
}
origin: novarto-oss/sane-dbc

@Test
public void checkMigrationsAreApplied()
{
  SyncDbInterpreter dbi = new SyncDbInterpreter(
      // provide a piece of code which knows how to spawn connections
      // in this case we are just using the DriverManager
      () -> DriverManager.getConnection(FLYWAY_JDBC_URL, "sa", "")
  );
  // check that after flyway migrations are applied the count of FOO is 3
  final Long count = dbi.submit(new AggregateOp("SELECT COUNT(*) FROM FLYWAY.FOO"));
  assertThat(count, is(3L));
}
origin: novarto-oss/sane-dbc

Long count = sync.submit(new AggregateOp("SELECT COUNT(*) FROM DUMMY"));
assertThat(count, is(1L));
  count = sync.submit(new AggregateOp("SELECT COUNT(*) FROM DUMMY"));
Validation<Exception, Long> successExpected = vdb.submit(new AggregateOp("SELECT COUNT(*) FROM DUMMY")).f();
assertThat(successExpected.isSuccess(), is(true));
assertThat(successExpected.success(), is(1L));
  CompletableFuture<Long> countFuture = async.submit(new AggregateOp("SELECT COUNT(*) FROM DUMMY"));
  CompletableFuture<Long> failedFuture = async.submit(new AggregateOp("BLA BLA BLA"));
com.novarto.sanedbc.core.opsAggregateOp

Most used methods

  • <init>
  • bind
  • map

Popular in Java

  • Reading from database using SQL prepared statement
  • getApplicationContext (Context)
  • addToBackStack (FragmentTransaction)
  • getContentResolver (Context)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • ArrayList (java.util)
    Resizable-array implementation of the List interface. Implements all optional list operations, and p
  • JPanel (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
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