tech.ydb.jdbc.settings.YdbOperationProperty Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ydb-jdbc-driver Show documentation
Show all versions of ydb-jdbc-driver Show documentation
JDBC Driver over YDB Java SDK
package tech.ydb.jdbc.settings;
import java.sql.Connection;
import java.time.Duration;
import java.util.Collection;
import javax.annotation.Nullable;
import tech.ydb.jdbc.YdbConst;
public class YdbOperationProperty extends AbstractYdbProperty {
private static final PropertiesCollector> PROPERTIES = new PropertiesCollector<>();
public static final YdbOperationProperty JOIN_DURATION =
new YdbOperationProperty<>(
"joinDuration",
"Default timeout for all YDB operations",
"5m",
Duration.class,
PropertyConverter.durationValue());
public static final YdbOperationProperty QUERY_TIMEOUT =
new YdbOperationProperty<>(
"queryTimeout",
"Default timeout for all YDB data queries, scheme and explain operations",
"0s",
Duration.class,
PropertyConverter.durationValue());
public static final YdbOperationProperty SCAN_QUERY_TIMEOUT =
new YdbOperationProperty<>(
"scanQueryTimeout",
"Default timeout for all YDB scan queries",
"5m",
Duration.class,
PropertyConverter.durationValue());
public static final YdbOperationProperty FAIL_ON_TRUNCATED_RESULT =
new YdbOperationProperty<>(
"failOnTruncatedResult",
"Throw an exception when received truncated result",
"false",
Boolean.class,
PropertyConverter.booleanValue());
public static final YdbOperationProperty SESSION_TIMEOUT =
new YdbOperationProperty<>(
"sessionTimeout",
"Default timeout to create a session",
"5s",
Duration.class,
PropertyConverter.durationValue());
public static final YdbOperationProperty DEADLINE_TIMEOUT =
new YdbOperationProperty<>(
"deadlineTimeout",
"Deadline timeout for all operations",
"0s",
Duration.class,
PropertyConverter.durationValue());
public static final YdbOperationProperty AUTOCOMMIT =
new YdbOperationProperty<>(
"autoCommit",
"Auto commit all operations",
"true",
Boolean.class,
PropertyConverter.booleanValue());
public static final YdbOperationProperty TRANSACTION_LEVEL =
new YdbOperationProperty<>(
"transactionLevel",
"Default transaction isolation level",
String.valueOf(Connection.TRANSACTION_SERIALIZABLE),
Integer.class,
PropertyConverter.integerValue());
//
// Some JDBC driver specific options
public static final YdbOperationProperty CACHE_CONNECTIONS_IN_DRIVER =
new YdbOperationProperty<>("cacheConnectionsInDriver",
"Cache YDB connections in YdbDriver, cached by combination or url and properties",
"true",
Boolean.class,
PropertyConverter.booleanValue());
public static final YdbOperationProperty ENFORCE_SQL_V1 =
new YdbOperationProperty<>("enforceSqlV1",
"Enforce SQL v1 grammar by adding --!syntax_v1 in the beginning of each SQL statement",
"false",
Boolean.class,
PropertyConverter.booleanValue());
public static final YdbOperationProperty DISABLE_DETECT_SQL_OPERATIONS =
new YdbOperationProperty<>("disableDetectSqlOperations",
"Disable detecting SQL operation based on SQL keywords",
"false",
Boolean.class,
PropertyConverter.booleanValue());
public static final YdbOperationProperty DISABLE_PREPARE_DATAQUERY =
new YdbOperationProperty<>("disablePrepareDataQuery",
"Disable executing #prepareDataQuery when creating PreparedStatements",
"false",
Boolean.class,
PropertyConverter.booleanValue());
public static final YdbOperationProperty DISABLE_AUTO_PREPARED_BATCHES =
new YdbOperationProperty<>("disableAutoPreparedBatches",
"Disable automatically detect list of tuples or structs in prepared statement",
"false",
Boolean.class,
PropertyConverter.booleanValue());
public static final YdbOperationProperty DISABLE_JDBC_PARAMETERS =
new YdbOperationProperty<>("disableJdbcParameters",
"Disable auto detect JDBC standart parameters '?'",
"false",
Boolean.class,
PropertyConverter.booleanValue());
public static final YdbOperationProperty DISABLE_JDBC_PARAMETERS_DECLARE =
new YdbOperationProperty<>("disableJdbcParameterDeclare",
"Disable enforce DECLARE section for JDBC parameters '?'",
"false",
Boolean.class,
PropertyConverter.booleanValue());
public static final YdbOperationProperty JDBC_SUPPORT_LEVEL =
new YdbOperationProperty<>("jdbcSupportLevel",
"Disable auto detect JDBC standart parameters '?'",
"" + YdbConst.DEFAULT_JDBC_SUPPORT_LEVEL,
Integer.class,
PropertyConverter.integerValue());
protected YdbOperationProperty(String name,
String description,
@Nullable String defaultValue,
Class type,
PropertyConverter converter) {
super(name, description, defaultValue, type, converter, (op, value) -> {});
PROPERTIES.register(this);
}
public static Collection> properties() {
return PROPERTIES.properties();
}
}