List of usage examples for org.apache.ibatis.jdbc SqlRunner SqlRunner
public SqlRunner(Connection connection)
From source file:com.glaf.core.test.MyBatisJdbcRunnerTest.java
License:Apache License
@Test public void testSelectMany() { Connection connection = null; SqlRunner runner = null;// ww w. j a v a 2 s .c o m try { connection = DBConnectionFactory.getConnection(); runner = new SqlRunner(connection); Object[] args = { "SYS", "fs_%" }; List<Map<String, Object>> dataList = runner .selectAll(" select * from SYS_PROPERTY where CATEGORY_ = ? and NAME_ like ? ", args); System.out.println(dataList); } catch (Exception ex) { ex.printStackTrace(); } finally { JdbcUtils.close(connection); } }
From source file:com.glaf.core.test.MyBatisJdbcRunnerTest.java
License:Apache License
@Test public void testSelectOne() { Connection connection = null; SqlRunner runner = null;/* w w w .j ava2s . c o m*/ try { connection = DBConnectionFactory.getConnection(); runner = new SqlRunner(connection); Object args = "res_system_name"; Map<String, Object> dataMap = runner.selectOne("select * from SYS_PROPERTY where NAME_ = ? ", args); System.out.println(dataMap); } catch (Exception ex) { ex.printStackTrace(); } finally { JdbcUtils.close(connection); } }
From source file:com.glaf.core.test.MyBatisJdbcRunnerTest.java
License:Apache License
@Test public void testSelectOne2() { Connection connection = null; SqlRunner runner = null;/*from www . j av a2 s . c o m*/ try { connection = DBConnectionFactory.getConnection("wechat"); runner = new SqlRunner(connection); Object args = "res_system_name"; Map<String, Object> dataMap = runner.selectOne("select * from SYS_PROPERTY where NAME_ = ? ", args); System.out.println(dataMap); } catch (Exception ex) { ex.printStackTrace(); } finally { JdbcUtils.close(connection); } }
From source file:com.glaf.core.test.MyBatisJdbcRunnerTest.java
License:Apache License
@Test public void testSelectOne3() { Connection connection = null; SqlRunner runner = null;//from ww w. j a va 2 s . com try { connection = DBConnectionFactory.getConnection("yz"); runner = new SqlRunner(connection); Object args = "res_system_name"; Map<String, Object> dataMap = runner.selectOne("select * from SYS_PROPERTY where NAME_ = ? ", args); System.out.println(dataMap); } catch (Exception ex) { ex.printStackTrace(); } finally { JdbcUtils.close(connection); } }
From source file:com.glaf.core.test.MyBatisTest.java
License:Apache License
@Test public void testSqlRunnerSelectOne() { SqlRunner runner = null;// w ww .ja va 2s.c o m java.sql.Connection conn = null; try { conn = DBConnectionFactory.getConnection(); runner = new SqlRunner(conn); Map<String, Object> row = runner.selectOne("select * from sys_dbid where NAME_ = ? ", "next.dbid"); System.out.println("One#######:" + row); } catch (Exception ex) { ex.printStackTrace(); } finally { JdbcUtils.close(conn); } }
From source file:com.glaf.core.test.MyBatisTest.java
License:Apache License
@Test public void testSqlRunnerSelectAll() { SqlRunner runner = null;//from w ww. j av a 2 s . co m java.sql.Connection conn = null; try { conn = DBConnectionFactory.getConnection(); runner = new SqlRunner(conn); List<Map<String, Object>> rows = runner.selectAll("select * from sys_dbid"); System.out.println("All#######:" + rows); } catch (Exception ex) { ex.printStackTrace(); } finally { JdbcUtils.close(conn); } }