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

How to use
MapHandler
in
org.apache.commons.dbutils.handlers

Best Java code snippets using org.apache.commons.dbutils.handlers.MapHandler (Showing top 7 results out of 315)

origin: com.goldmansachs.obevo/obevo-db

public MutableMap<String, Object> queryForMap(Connection conn, String sql) {
  return MapAdapter.adapt(this.query(conn, sql, new MapHandler()));
}
origin: goldmansachs/obevo

public MutableMap<String, Object> queryForMap(Connection conn, String sql) {
  return MapAdapter.adapt(this.query(conn, sql, new MapHandler()));
}
origin: com.github.biezhi/unique-support-orm

/**
 * 根据sql查询一个map
 */
public static Map<String, Object> findMap(String sql, Object... params) {
  Map<String, Object> map;
  try {
    logger.debug("Sql:" + sql);
    logger.debug("Parameters:" + Arrays.toString(params));
    map = getQueryRunner().query(getConn(), sql, new MapHandler(), params);
  } catch (SQLException e) {
    throw new QueryException(e);
  }
  return map;
}
origin: hellobike/tunnel

private Map<String, Object> executeQuery(String sql, InvokeContext context) {
  Connection connection = null;
  try {
    connection = getConnection(context);
    QueryRunner qr = new QueryRunner();
    Map<String, Object> query = qr.query(connection, sql, new MapHandler());
    if (query == null || query.isEmpty()) {
      query = new LinkedHashMap<>();
      LOG.warn("Select Nothing By SQL:{}", sql);
    }
    return query;
  } catch (Exception e) {
    //
  } finally {
    closeClosable(connection);
  }
  return new LinkedHashMap<>();
}
origin: Leytton/ThinkJD

public long add() throws Exception{
  try {
    if (buildSql_Insert()) {
      Map<String, Object> result_insert = new QueryRunner().insert(conn, sql, new MapHandler(), param_data);
      long id=0;
      if(null!=result_insert && result_insert.containsKey("GENERATED_KEY")) {
        id = (long) result_insert.get("GENERATED_KEY");
      }
      D.autoCloseConn(conn);
      return id;
    }
  } catch (Exception e) {
    D.autoCloseConn(conn);
    throw e;
  }
  return 0;
}
origin: commons-dbutils/commons-dbutils

public void testEmptyResultSetHandle() throws SQLException {
  ResultSetHandler<Map<String,Object>> h = new MapHandler();
  Map<String,Object> results = h.handle(this.emptyResultSet);
  assertNull(results);
}
origin: commons-dbutils/commons-dbutils

public void testHandle() throws SQLException {
  ResultSetHandler<Map<String,Object>> h = new MapHandler();
  Map<String,Object> results = h.handle(this.rs);
  assertNotNull(results);
  assertEquals(COLS, results.keySet().size());
  assertEquals("1", results.get("ONE"));
  assertEquals("2", results.get("two"));
  assertEquals("THREE", results.get("Three"));
}
org.apache.commons.dbutils.handlersMapHandler

Javadoc

ResultSetHandler implementation that converts the first ResultSet row into a Map. This class is thread safe.

Most used methods

  • <init>
    Creates a new instance of MapHandler.

Popular in Java

  • Creating JSON documents from java classes using gson
  • findViewById (Activity)
  • scheduleAtFixedRate (Timer)
  • startActivity (Activity)
  • 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
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • CodeWhisperer alternatives
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