本文整理汇总了Java中com.j256.ormlite.stmt.PreparedUpdate类的典型用法代码示例。如果您正苦于以下问题:Java PreparedUpdate类的具体用法?Java PreparedUpdate怎么用?Java PreparedUpdate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PreparedUpdate类属于com.j256.ormlite.stmt包,在下文中一共展示了PreparedUpdate类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: rxUpdate
import com.j256.ormlite.stmt.PreparedUpdate; //导入依赖的package包/类
@Override
public Observable<Integer> rxUpdate(final PreparedUpdate<DataType> preparedUpdate) {
final Func0<Observable<Integer>> loFunc = () -> {
try {
return Observable.just(update(preparedUpdate));
} catch (SQLException e) {
return Observable.error(e);
}
};
return Observable.defer(loFunc);
}
开发者ID:RoRoche,项目名称:AndroidStarter,代码行数:12,代码来源:RxBaseDaoImpl.java
示例2: updateAll
import com.j256.ormlite.stmt.PreparedUpdate; //导入依赖的package包/类
private static <E extends Entity> long updateAll(final Dao<E, ?> dao, final UpdateBuilder<E, ?> updateBuilder, final Date now) throws SQLException {
updateBuilder.updateColumnValue(Entity.COLUMN_NAME_UPDATED_AT, now);
final PreparedUpdate<E> preparedUpdate = updateBuilder.prepare();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("updateAll: " + ReflectionToStringBuilder.toString(dao) + ", " + preparedUpdate);
}
final long result = dao.update(preparedUpdate);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("updateAll: " + result);
}
return result;
}
开发者ID:t3t5u,项目名称:common-ormlite,代码行数:13,代码来源:AbstractDao.java
示例3: update
import com.j256.ormlite.stmt.PreparedUpdate; //导入依赖的package包/类
public int update(PreparedUpdate<T> paramPreparedUpdate)
{
checkForInitialized();
DatabaseConnection localDatabaseConnection = this.connectionSource.getReadWriteConnection();
try
{
int i = this.statementExecutor.update(localDatabaseConnection, paramPreparedUpdate);
return i;
}
finally
{
this.connectionSource.releaseConnection(localDatabaseConnection);
}
}
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:15,代码来源:BaseDaoImpl.java
示例4: update
import com.j256.ormlite.stmt.PreparedUpdate; //导入依赖的package包/类
public int update(PreparedUpdate<T> paramPreparedUpdate)
{
try
{
int i = this.dao.update(paramPreparedUpdate);
return i;
}
catch (SQLException localSQLException)
{
logMessage(localSQLException, "update threw exception on: " + paramPreparedUpdate);
throw new RuntimeException(localSQLException);
}
}
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:14,代码来源:RuntimeExceptionDao.java
示例5: update
import com.j256.ormlite.stmt.PreparedUpdate; //导入依赖的package包/类
@Override
public int update(PreparedUpdate<T> preparedUpdate) throws SQLException {
checkForInitialized();
DatabaseConnection connection = connectionSource.getReadWriteConnection(tableInfo.getTableName());
try {
return statementExecutor.update(connection, preparedUpdate);
} finally {
connectionSource.releaseConnection(connection);
}
}
开发者ID:j256,项目名称:ormlite-core,代码行数:11,代码来源:BaseDaoImpl.java
示例6: update
import com.j256.ormlite.stmt.PreparedUpdate; //导入依赖的package包/类
/**
* @see Dao#update(PreparedUpdate)
*/
@Override
public int update(PreparedUpdate<T> preparedUpdate) {
try {
return dao.update(preparedUpdate);
} catch (SQLException e) {
logMessage(e, "update threw exception on: " + preparedUpdate);
throw new RuntimeException(e);
}
}
开发者ID:j256,项目名称:ormlite-core,代码行数:13,代码来源:RuntimeExceptionDao.java
示例7: testUpdatePreparedThrow
import com.j256.ormlite.stmt.PreparedUpdate; //导入依赖的package包/类
@Test(expected = RuntimeException.class)
public void testUpdatePreparedThrow() throws Exception {
@SuppressWarnings("unchecked")
Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class);
RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao);
expect(dao.update((PreparedUpdate<Foo>) null)).andThrow(new SQLException("Testing catch"));
replay(dao);
rtDao.update((PreparedUpdate<Foo>) null);
verify(dao);
}
开发者ID:j256,项目名称:ormlite-core,代码行数:11,代码来源:RuntimeExceptionDaoTest.java
示例8: update
import com.j256.ormlite.stmt.PreparedUpdate; //导入依赖的package包/类
public int update(PreparedUpdate<T> preparedUpdate) throws SQLException {
return dao.update(preparedUpdate);
}
开发者ID:citiususc,项目名称:calendula,代码行数:4,代码来源:GenericDao.java
示例9: removeMetadataParent
import com.j256.ormlite.stmt.PreparedUpdate; //导入依赖的package包/类
/**
* Remove metadata references (by updating the field to null) with foreign
* keys to the metadata parent id
*
* @param parentId
* parent id
* @return updated count
* @throws SQLException
*/
public int removeMetadataParent(long parentId) throws SQLException {
UpdateBuilder<MetadataReference, Void> ub = updateBuilder();
ub.updateColumnValue(MetadataReference.COLUMN_PARENT_ID, null);
ub.where().eq(MetadataReference.COLUMN_PARENT_ID, parentId);
PreparedUpdate<MetadataReference> update = ub.prepare();
int updated = update(update);
return updated;
}
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:22,代码来源:MetadataReferenceDao.java
示例10: rxUpdate
import com.j256.ormlite.stmt.PreparedUpdate; //导入依赖的package包/类
/**
* Update all rows in the table according to the prepared statement parameter. To use this, the
* {@link UpdateBuilder} must have set-columns applied to it using the
* {@link UpdateBuilder#updateColumnValue(String, Object)} or
* {@link UpdateBuilder#updateColumnExpression(String, String)} methods.
*
* @param preparedUpdate A prepared statement to match database rows to be rxDeleted and define the columns to update.
* @return The number of rows updated in the database.
* @throws SQLException on any SQL problems.
* @throws IllegalArgumentException If there is only an ID field in the object. See the {@link #updateId} method.
*/
Observable<Integer> rxUpdate(final PreparedUpdate<T> preparedUpdate);
开发者ID:RoRoche,项目名称:AndroidStarter,代码行数:13,代码来源:IRxDao.java
示例11: update
import com.j256.ormlite.stmt.PreparedUpdate; //导入依赖的package包/类
/**
* Update all rows in the table according to the prepared statement parameter. To use this, the
* {@link UpdateBuilder} must have set-columns applied to it using the
* {@link UpdateBuilder#updateColumnValue(String, Object)} or
* {@link UpdateBuilder#updateColumnExpression(String, String)} methods.
*
* @param preparedUpdate
* A prepared statement to match database rows to be deleted and define the columns to update.
* @return The number of rows updated in the database.
* @throws SQLException
* on any SQL problems.
* @throws IllegalArgumentException
* If there is only an ID field in the object. See the {@link #updateId} method.
*/
public int update(PreparedUpdate<T> preparedUpdate) throws SQLException;
开发者ID:j256,项目名称:ormlite-core,代码行数:16,代码来源:Dao.java
示例12: update
import com.j256.ormlite.stmt.PreparedUpdate; //导入依赖的package包/类
public abstract int update(PreparedUpdate<T> paramPreparedUpdate);
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:2,代码来源:Dao.java
注:本文中的com.j256.ormlite.stmt.PreparedUpdate类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论