本文整理了Java中org.h2.value.Value.set()
方法的一些代码示例,展示了Value.set()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Value.set()
方法的具体详情如下:
包路径:org.h2.value.Value
类名称:Value
方法名:set
[英]Set the value as a parameter in a prepared statement.
[中]在准备好的语句中将该值设置为参数。
代码示例来源:origin: com.h2database/h2
private void setKey(PreparedStatement prep, int start, Value[] current)
throws SQLException {
for (int i = 0, size = key.size(); i < size; i++) {
String col = key.get(i);
int idx = getColumnIndex(col);
Value v = current[idx];
if (v == null || v == ValueNull.INSTANCE) {
// rows with a unique key containing NULL are not supported,
// as multiple such rows could exist
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);
}
v.set(prep, start + i);
}
}
代码示例来源:origin: com.h2database/h2
v = current[i];
v.set(prep, j++);
代码示例来源:origin: com.h2database/h2
for (int i = 0, size = params.size(); i < size; i++) {
Value v = params.get(i);
v.set(prep, i + 1);
代码示例来源:origin: com.h2database/h2
Value v = row[i];
if (v != null) {
v.set(prep, j++ + 1);
代码示例来源:origin: org.wowtools/h2
private void setKey(PreparedStatement prep, int start, Value[] current)
throws SQLException {
for (int i = 0, size = key.size(); i < size; i++) {
String col = key.get(i);
int idx = getColumnIndex(col);
Value v = current[idx];
if (v == null || v == ValueNull.INSTANCE) {
// rows with a unique key containing NULL are not supported,
// as multiple such rows could exist
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);
}
v.set(prep, start + i);
}
}
代码示例来源:origin: com.eventsourcing/h2
private void setKey(PreparedStatement prep, int start, Value[] current)
throws SQLException {
for (int i = 0, size = key.size(); i < size; i++) {
String col = key.get(i);
int idx = getColumnIndex(col);
Value v = current[idx];
if (v == null || v == ValueNull.INSTANCE) {
// rows with a unique key containing NULL are not supported,
// as multiple such rows could exist
throw DbException.get(ErrorCode.NO_DATA_AVAILABLE);
}
v.set(prep, start + i);
}
}
代码示例来源:origin: com.h2database/com.springsource.org.h2
public void insertRow(Value[] row) throws SQLException {
StringBuffer buff = new StringBuffer();
buff.append("INSERT INTO ");
appendTableName(buff);
buff.append('(');
appendColumnList(buff, false);
buff.append(")VALUES(");
for (int i = 0; i < columnCount; i++) {
if (i > 0) {
buff.append(',');
}
buff.append('?');
}
buff.append(')');
PreparedStatement prep = conn.prepareStatement(buff.toString());
for (int i = 0; i < columnCount; i++) {
Value v = row[i];
if (v == null) {
v = ValueNull.INSTANCE;
}
v.set(prep, i + 1);
}
int count = prep.executeUpdate();
if (count != 1) {
throw Message.getSQLException(ErrorCode.NO_DATA_AVAILABLE);
}
}
代码示例来源:origin: com.h2database/com.springsource.org.h2
public void updateRow(Value[] current, Value[] updateRow) throws SQLException {
StringBuffer buff = new StringBuffer();
buff.append("UPDATE ");
appendTableName(buff);
buff.append(" SET ");
appendColumnList(buff, true);
// TODO updatable result set: we could add all current values to the
// where clause
// - like this optimistic ('no') locking is possible
appendKeyCondition(buff);
PreparedStatement prep = conn.prepareStatement(buff.toString());
int j = 1;
for (int i = 0; i < columnCount; i++) {
Value v = updateRow[i];
if (v == null) {
v = current[i];
}
v.set(prep, j++);
}
setKey(prep, j, current);
int count = prep.executeUpdate();
if (count != 1) {
// the row has been deleted
throw Message.getSQLException(ErrorCode.NO_DATA_AVAILABLE);
}
}
代码示例来源:origin: com.h2database/com.springsource.org.h2
Value v = row.getValue(i);
if (v != null && v != ValueNull.INSTANCE) {
v.set(prep, j + 1);
j++;
代码示例来源:origin: com.h2database/com.springsource.org.h2
private void setKey(PreparedStatement prep, int start, Value[] current) throws SQLException {
for (int i = 0; i < key.size(); i++) {
String col = (String) key.get(i);
int idx = getColumnIndex(col);
Value v = current[idx];
if (v == null || v == ValueNull.INSTANCE) {
// rows with a unique key containing NULL are not supported,
// as multiple such rows could exist
throw Message.getSQLException(ErrorCode.NO_DATA_AVAILABLE);
}
v.set(prep, start + i);
}
}
代码示例来源:origin: com.h2database/com.springsource.org.h2
Value v = row.getValue(i);
if (!isNull(v)) {
v.set(prep, j + 1);
j++;
代码示例来源:origin: com.h2database/com.springsource.org.h2
Value v = first.getValue(i);
if (v != null) {
v.set(prep, j + 1);
j++;
Value v = last.getValue(i);
if (v != null) {
v.set(prep, j + 1);
j++;
代码示例来源:origin: com.h2database/com.springsource.org.h2
PreparedStatement prep = link.getPreparedStatement(sql);
for (int i = 0; i < newRow.getColumnCount(); i++) {
newRow.getValue(i).set(prep, j);
j++;
Value v = oldRow.getValue(i);
if (!isNull(v)) {
v.set(prep, j);
j++;
代码示例来源:origin: com.eventsourcing/h2
v = current[i];
v.set(prep, j++);
代码示例来源:origin: org.wowtools/h2
v = current[i];
v.set(prep, j++);
代码示例来源:origin: org.wowtools/h2
for (int i = 0, size = params.size(); i < size; i++) {
Value v = params.get(i);
v.set(prep, i + 1);
代码示例来源:origin: com.eventsourcing/h2
for (int i = 0, size = params.size(); i < size; i++) {
Value v = params.get(i);
v.set(prep, i + 1);
代码示例来源:origin: org.wowtools/h2
Value v = row[i];
if (v != null) {
v.set(prep, j++ + 1);
代码示例来源:origin: com.eventsourcing/h2
Value v = row[i];
if (v != null) {
v.set(prep, j++ + 1);
内容来源于网络,如有侵权,请联系作者删除!