org.jsimpledb.kv.mysql.MySQLKVTransaction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsimpledb-kv-mysql Show documentation
Show all versions of jsimpledb-kv-mysql Show documentation
JSimpleDB key/value store based on MySQL.
/*
* Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
*/
package org.jsimpledb.kv.mysql;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import org.jsimpledb.kv.sql.SQLKVDatabase;
import org.jsimpledb.kv.sql.SQLKVTransaction;
/**
* MySQL variant of {@link SQLKVTransaction}.
*/
class MySQLKVTransaction extends SQLKVTransaction {
MySQLKVTransaction(SQLKVDatabase database, Connection connection) throws SQLException {
super(database, connection);
}
@Override
public void setTimeout(long timeout) {
super.setTimeout(timeout);
try (final Statement statement = this.connection.createStatement()) {
statement.execute("SET innodb_lock_wait_timeout = " + (timeout + 999) / 1000);
} catch (SQLException e) {
throw this.handleException(e);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy