private static String preprocessSql(String sql, Map<String, Object> params) {
        if (sql.contains(":map")) {
            StringBuilder sb = new StringBuilder();
            boolean first = true;
            for (String key: params.keySet()) {
                if (!first) sb.append(", ");
                sb.append(key).append(" = ").append(":").append(key).append(" ");
                first = false;
            }
            return sql.replace(":map", sb.toString());
        }
        if (sql.contains(":insert")) {
            StringBuilder names = new StringBuilder();
            StringBuilder values = new StringBuilder();
            boolean first = true;
            for (String key: params.keySet()) {
                if (!first) {
                    names.append(", ");
                    values.append(", ");
                }
                names.append("`").append(key).append("` ");
                values.append(":").append(key).append(" ");
                first = false;
            }
            return sql.replace(":insert", "(" + names + ") values (" + values + ")");

        }
        return sql;
    }