Tabnine Logo
DBI.useHandle
Code IndexAdd Tabnine to your IDE (free)

How to use
useHandle
method
in
org.skife.jdbi.v2.DBI

Best Java code snippets using org.skife.jdbi.v2.DBI.useHandle (Showing top 9 results out of 315)

origin: io.syndesis.rest/rest-filestore

@SuppressWarnings("PMD.EmptyCatchBlock")
public void destroy() {
  try {
    dbi.useHandle(h -> h.execute("DROP TABLE filestore"));
  } catch (CallbackFailedException ex) {
    // simply ignore
  }
}
origin: io.syndesis/filestore

@SuppressWarnings("PMD.EmptyCatchBlock")
public void destroy() {
  try {
    dbi.useHandle(h -> h.execute("DROP TABLE filestore"));
  } catch (CallbackFailedException ex) {
    // simply ignore
  }
}
origin: io.syndesis.server/server-filestore

@SuppressWarnings("PMD.EmptyCatchBlock")
public void destroy() {
  try {
    dbi.useHandle(h -> h.execute("DROP TABLE filestore"));
  } catch (CallbackFailedException ex) {
    // simply ignore
  }
}
origin: io.syndesis/filestore

@SuppressWarnings("PMD.EmptyCatchBlock")
public void destroy() {
  try {
    dbi.useHandle(h -> h.execute("DROP TABLE icon_filestore"));
  } catch (CallbackFailedException ex) {
    // simply ignore
  }
}
origin: org.jdbi/jdbi

  @Test
  public void testUseHandle() throws Exception
  {
    DBI dbi = new DBI(DERBY_HELPER.getDataSource());
    dbi.useHandle(new HandleConsumer() {
      @Override
      public void useHandle(Handle handle) throws Exception {
        handle.insert("insert into something (id, name) values (1, 'Brian')");
        String value = handle.createQuery("select name from something where id = 1").map(Something.class).first().getName();
        assertEquals("Brian", value);
      }
    });
  }
}
origin: io.syndesis.rest/rest-filestore

public void init() {
  boolean needsInitialization = !dbi.inTransaction((h, s) -> tableExists(h, "filestore"));
  if (needsInitialization) {
    try {
      dbi.useHandle(h -> {
        if (databaseKind == DatabaseKind.PostgreSQL) {
          h.execute("CREATE TABLE filestore (path VARCHAR COLLATE \"C\" PRIMARY KEY, data OID)");
        } else if (databaseKind == DatabaseKind.H2) {
          h.execute("CREATE TABLE filestore (path VARCHAR PRIMARY KEY, data BLOB)");
        } else if (databaseKind == DatabaseKind.Apache_Derby) {
          h.execute("CREATE TABLE filestore (path VARCHAR(1000), data BLOB, PRIMARY KEY (path))");
        } else {
          throw new DaoException("Unsupported database kind: " + databaseKind);
        }
      });
    } catch (CallbackFailedException ex) {
      throw new DaoException("Unable to initialize the filestore", ex);
    }
  }
}
origin: io.syndesis/filestore

@Override
public void init() {
  boolean needsInitialization = !dbi.inTransaction((h, s) -> tableExists(h, "icon_filestore"));
  if (needsInitialization) {
    try {
      dbi.useHandle(h -> {
        if (databaseKind == DatabaseKind.PostgreSQL) {
          h.execute("CREATE TABLE icon_filestore (id VARCHAR COLLATE \"C\" PRIMARY KEY, data OID)");
        } else if (databaseKind == DatabaseKind.H2) {
          h.execute("CREATE TABLE icon_filestore (id VARCHAR PRIMARY KEY, data BLOB)");
        } else if (databaseKind == DatabaseKind.Apache_Derby) {
          h.execute("CREATE TABLE icon_filestore (id VARCHAR(1000), data BLOB, PRIMARY KEY (path))");
        } else {
          throw new IconDataAccessException("Unsupported database kind: " + databaseKind);
        }
      });
    } catch (CallbackFailedException ex) {
      throw new IconDataAccessException("Unable to initialize the icon_filestore", ex);
    }
  }
}
origin: io.syndesis.server/server-filestore

public void init() {
  boolean needsInitialization = !dbi.inTransaction((h, s) -> tableExists(h, "filestore"));
  if (needsInitialization) {
    try {
      dbi.useHandle(h -> {
        if (databaseKind == DatabaseKind.PostgreSQL) {
          h.execute("CREATE TABLE filestore (path VARCHAR COLLATE \"C\" PRIMARY KEY, data OID)");
        } else if (databaseKind == DatabaseKind.H2) {
          h.execute("CREATE TABLE filestore (path VARCHAR PRIMARY KEY, data BLOB)");
        } else if (databaseKind == DatabaseKind.Apache_Derby) {
          h.execute("CREATE TABLE filestore (path VARCHAR(1000), data BLOB, PRIMARY KEY (path))");
        } else {
          throw new DaoException("Unsupported database kind: " + databaseKind);
        }
      });
    } catch (CallbackFailedException ex) {
      throw new DaoException("Unable to initialize the filestore", ex);
    }
  }
}
origin: io.syndesis/filestore

@Override
public void init() {
  boolean needsInitialization = !dbi.inTransaction((h, s) -> tableExists(h, "filestore"));
  if (needsInitialization) {
    try {
      dbi.useHandle(h -> {
        if (databaseKind == DatabaseKind.PostgreSQL) {
          h.execute("CREATE TABLE filestore (path VARCHAR COLLATE \"C\" PRIMARY KEY, data OID)");
        } else if (databaseKind == DatabaseKind.H2) {
          h.execute("CREATE TABLE filestore (path VARCHAR PRIMARY KEY, data BLOB)");
        } else if (databaseKind == DatabaseKind.Apache_Derby) {
          h.execute("CREATE TABLE filestore (path VARCHAR(1000), data BLOB, PRIMARY KEY (path))");
        } else {
          throw new ExtensionDataAccessException("Unsupported database kind: " + databaseKind);
        }
      });
    } catch (CallbackFailedException ex) {
      throw new ExtensionDataAccessException("Unable to initialize the filestore", ex);
    }
  }
}
org.skife.jdbi.v2DBIuseHandle

Popular methods of DBI

  • <init>
    Constructor used to allow for obtaining a Connection in a customized manner. The org.skife.jdbi.v2.t
  • open
  • onDemand
    Create a new sql object which will obtain and release connections from this dbi instance, as it need
  • registerMapper
    Register a result set mapper which will have its parameterized type inspected to determine what it m
  • withHandle
    A convenience function which manages the lifecycle of a handle and yields it to a callback for use b
  • registerArgumentFactory
  • inTransaction
  • setSQLLog
    Specify the class used to log sql statements. Will be passed to all handles created from this instan
  • registerContainerFactory
  • setStatementLocator
    Use a non-standard StatementLocator to look up named statements for all handles created from this DB
  • setStatementRewriter
    Use a non-standard StatementRewriter to transform SQL for all Handle instances created by this DBI.
  • setTransactionHandler
    Specify the TransactionHandler instance to use. This allows overriding transaction semantics, or map
  • setStatementRewriter,
  • setTransactionHandler,
  • setTimingCollector,
  • define,
  • close,
  • getStatementLocator,
  • getTransactionHandler,
  • registerColumnMapper

Popular in Java

  • Running tasks concurrently on multiple threads
  • notifyDataSetChanged (ArrayAdapter)
  • putExtra (Intent)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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