Popular Posts
javax.net.ssl.SSLHandshakeException: Connection closed by peer in Android 5.0 Lollipop Recently, there is a error occurs when access website via ssl connection like below although it worked fine several days ago. // Enable SSL... Tired of Hibernate? Try JDBI in your code JDBI Quick sample ICategoryDAO.java : create a data access interface (implement is not required) package com.prhythm.erotic.task.data.... Enable SSL connection for Jsoup import org.jsoup.Connection; import org.jsoup.Jsoup; import javax.net.ssl.*; import java.io.IOException; import java.security.KeyManagement...
Stats
SqlCommand (Sample)
new SqlCommand() //
.setDebugMode(true)
.setConnection(Connector.get())
.setCommandText("SELECT" +
        "    e.entry_id," +
        "    e.entry_name," +
        "    e.entry_english_name," +
        "    e.entry_description," +
        "    e.entry_sop_path," +
        "    e.entry_cordon," +
        "    e.role_name," +
        "    e.entry_enabled," +
        "    e.group_id," +
        "    e.group_name" +
        " FROM mv_wrk e" +
        " WHERE" +
        "    (&entry_id IS NULL OR UPPER(e.entry_id) LIKE UPPER(&entry_id))" +
        "    AND (&entry_name IS NULL OR UPPER(e.entry_name) LIKE UPPER(&entry_name))" +
        "    AND (&entry_english_name IS NULL OR UPPER(e.entry_english_name) LIKE UPPER(&entry_english_name))" +
        "    AND (&entry_enabled IS NULL OR e.entry_enabled = &entry_enabled)" +
        " ORDER BY e.entry_id ASC")
.addParameter("&entry_id", OracleDataType.VARCHAR2)
.addParameter("&entry_name", OracleDataType.VARCHAR2, null)
.addParameter(new SqlParameter("&entry_english_name", OracleDataType.VARCHAR2))
.addParameter(new SqlParameter("&entry_enabled", OracleDataType.NUMBER).setValue(null))
.setAdapter(new QueryAdapter() {
    @Override
    public void executedQuery(SqlArgument arg) throws Exception {
        ResultSet rs;
        if ((rs = ((QueryArgument) arg).resultset) == null)
            return;

        while (rs.next()) {
            System.err.println(DataMap.fill(rs));
        }
    }
})
.query();
batch
new SqlCommand()
.setDebugMode(true)
.setDebugOut(System.err)
.setConnection(ConnectionUtil.get())
.addCommand("/* 1. &name 2. &aid  3. &time */ INSERT INTO access_log VALUES(&aid, &name, &time)", CommandType.Text, CommandMode.Batch)
.addCommand("SELECT * FROM access_log WHERE rownum < &rows ORDER BY time DESC")
.addParameter("&rows", OracleDataType.INT, 5)
.setAdapter(new QueryListener() {
    @Override
    public boolean executingQuery(SqlArgument arg) throws Exception {
        if (arg.first && arg.mode == CommandMode.Batch)
            for (int i = 0; i < 3; i++) {
                arg.addBatchParameters(
                    new SqlParameter("&name", OracleDataType.VARCHAR2, "bruce"),
                    new SqlParameter("&aid", OracleDataType.VARCHAR2, UUID.randomUUID().toString()),
                    new SqlParameter("&time", OracleDataType.DATE, DateTime.now().toTimestamp())
                );
            }

        return true;
    }

    @Override
    public void executedQuery(SqlArgument arg) throws Exception {
        if (arg.first) {
            UpdateArgument ua = (UpdateArgument) arg;
            System.err.println(Arrays.toString(ua.batchResult));
        } else {
            QueryArgument argument = (QueryArgument) arg;
            if (argument.resultset != null)
                while (argument.resultset.next()) {
                    System.err.println(DataMap.fill(argument.resultset));
                }
        }
    }
})
.query();