本文整理了Java中org.sql2o.Query.bind
方法的一些代码示例,展示了Query.bind
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.bind
方法的具体详情如下:
包路径:org.sql2o.Query
类名称:Query
方法名:bind
暂无
代码示例来源:origin: iNPUTmice/caas
public static boolean addCredential(Connection connection, Credential credential) {
String query = "insert into credentials(domain,jid,password) values(:domain,:jid,:password)";
connection.createQuery(query).bind(credential).executeUpdate();
return true;
}
代码示例来源:origin: iNPUTmice/caas
public static boolean removeServer(Connection connection, Server server) {
String query = "delete from servers where domain=:domain";
connection.createQuery(query)
.bind(server)
.executeUpdate();
return true;
}
代码示例来源:origin: iNPUTmice/caas
public static boolean updateServer(Connection connection, Server newServer) {
String query = "update servers set" +
" domain=:domain," +
" listed=:listed," +
" software_name=:softwareName," +
" software_version=:softwareVersion" +
" where domain=:domain";
connection.createQuery(query)
.bind(newServer)
.executeUpdate();
return true;
}
代码示例来源:origin: iNPUTmice/caas
public static boolean addSubscriber(Connection connection, Subscriber subscriber) {
connection.createQuery("insert into subscribers(domain,email,unsubscribeCode) " +
"values(:domain,:email,:unsubscribeCode)")
.bind(subscriber)
.executeUpdate();
return true;
}
代码示例来源:origin: iNPUTmice/caas
public static boolean addServer(Connection connection, Server server) {
String query = "insert into servers(domain,listed,software_name,software_version) values(:domain,:listed,:softwareName,:softwareVersion)";
connection.createQuery(query).bind(server).executeUpdate();
return true;
}
代码示例来源:origin: iNPUTmice/caas
public static boolean removeCredential(Connection connection, Credential credential) {
String query = "delete from credentials where jid=:jid and password=:password";
connection.createQuery(query).bind(credential).executeUpdate();
return true;
}
代码示例来源:origin: lets-blade/blade-jdbc
public <S extends Serializable> S save() {
QueryMeta queryMeta = SqlBuilder.buildInsertSql(this);
Connection con = getConn();
log.debug(EXECUTE_SQL_PREFIX + " => {}", queryMeta.getSql());
log.debug(PARAMETER_PREFIX + " => {}", this);
Query query = con.createQuery(queryMeta.getSql()).bind(this);
try {
S s = (S) query.executeUpdate().getKey();
if (null == Base.connectionThreadLocal.get() && !con.getJdbcConnection().getAutoCommit()) {
con.commit();
}
return s;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: aalmiray/javatrove
private void update(final Todo todo) {
sql2oHandler.withSql2o(sql2o -> {
sql2o.withConnection((connection, argument) -> {
String sql = "UPDATE todos SET " +
"done = :done " +
"WHERE id = :id";
connection.createQuery(sql)
.bind(todo)
.executeUpdate();
});
return todo;
});
}
代码示例来源:origin: aalmiray/javatrove
private void insert(final Todo todo) {
sql2oHandler.withSql2o(sql2o -> {
sql2o.withConnection((connection, argument) -> {
String sql = "INSERT INTO todos(description, done) VALUES (:description, false)";
Object key = connection.createQuery(sql)
.bind(todo)
.executeUpdate()
.getKey();
todo.setId(((Number) key).longValue());
});
return todo;
});
}
内容来源于网络,如有侵权,请联系作者删除!