Skip to content

Commit

Permalink
fix: code formating
Browse files Browse the repository at this point in the history
  • Loading branch information
sheng.ps committed Jun 6, 2024
1 parent 794add2 commit 3faf3d3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 30 deletions.
57 changes: 29 additions & 28 deletions src/main/java/org/sqlite/SQLiteConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,9 @@ static DriverPropertyInfo[] getDriverPropertyInfo() {
return result;
}

static class OnOff {
private static final String[] Values = new String[] {"true", "false"};
}

static class OnOff {
private static final String[] Values = new String[] {"true", "false"};
}

static final Set<String> pragmaSet = new TreeSet<String>();

Expand Down Expand Up @@ -380,11 +379,14 @@ public enum Pragma {

// Parameters requiring SQLite3 API invocation
OPEN_MODE("open_mode", "Database open-mode flag", null),
SHARED_CACHE("shared_cache", "Enable SQLite Shared-Cache mode, native driver only", OnOff.Values),
SHARED_CACHE(
"shared_cache",
"Enable SQLite Shared-Cache mode, native driver only",
OnOff.Values),
LOAD_EXTENSION(
"enable_load_extension",
"Enable SQLite load_extension() function, native driver only",
OnOff.Values),
OnOff.Values),

// Pragmas that can be set after opening the database
CACHE_SIZE(
Expand All @@ -398,24 +400,25 @@ public enum Pragma {
CASE_SENSITIVE_LIKE(
"case_sensitive_like",
"Installs a new application-defined LIKE function that is either case sensitive or insensitive depending on the value",
OnOff.Values),
OnOff.Values),
COUNT_CHANGES("count_changes", "Deprecated", OnOff.Values),
DEFAULT_CACHE_SIZE("default_cache_size", "Deprecated", null),
DEFER_FOREIGN_KEYS(
"defer_foreign_keys",
"When the defer_foreign_keys PRAGMA is on, enforcement of all foreign key constraints is delayed until the outermost transaction is committed. The defer_foreign_keys pragma defaults to OFF so that foreign key constraints are only deferred if they are created as \"DEFERRABLE INITIALLY DEFERRED\". The defer_foreign_keys pragma is automatically switched off at each COMMIT or ROLLBACK. Hence, the defer_foreign_keys pragma must be separately enabled for each transaction. This pragma is only meaningful if foreign key constraints are enabled, of course.",
OnOff.Values),
OnOff.Values),
EMPTY_RESULT_CALLBACKS("empty_result_callback", "Deprecated", OnOff.Values),
ENCODING(
"encoding",
"Set the encoding that the main database will be created with if it is created by this session",
toStringArray(Encoding.values())),
FOREIGN_KEYS("foreign_keys", "Set the enforcement of foreign key constraints", OnOff.Values),
FOREIGN_KEYS(
"foreign_keys", "Set the enforcement of foreign key constraints", OnOff.Values),
FULL_COLUMN_NAMES("full_column_names", "Deprecated", OnOff.Values),
FULL_SYNC(
"fullsync",
"Whether or not the F_FULLFSYNC syncing method is used on systems that support it. Only Mac OS X supports F_FULLFSYNC.",
OnOff.Values),
OnOff.Values),
INCREMENTAL_VACUUM(
"incremental_vacuum",
"Causes up to N pages to be removed from the freelist. The database file is truncated by the same amount. The incremental_vacuum pragma has no effect if the database is not in auto_vacuum=incremental mode or if there are no pages on the freelist. If there are fewer than N pages on the freelist, or if N is less than 1, or if the \"(N)\" argument is omitted, then the entire freelist is cleared.",
Expand All @@ -441,11 +444,12 @@ public enum Pragma {
MAX_PAGE_COUNT(
"max_page_count", "Set the maximum number of pages in the database file", null),
READ_UNCOMMITTED("read_uncommitted", "Set READ UNCOMMITTED isolation", OnOff.Values),
RECURSIVE_TRIGGERS("recursive_triggers", "Set the recursive trigger capability", OnOff.Values),
RECURSIVE_TRIGGERS(
"recursive_triggers", "Set the recursive trigger capability", OnOff.Values),
REVERSE_UNORDERED_SELECTS(
"reverse_unordered_selects",
"When enabled, this PRAGMA causes many SELECT statements without an ORDER BY clause to emit their results in the reverse order from what they normally would",
OnOff.Values),
OnOff.Values),
SECURE_DELETE(
"secure_delete",
"When secure_delete is on, SQLite overwrites deleted content with zeros",
Expand Down Expand Up @@ -540,8 +544,6 @@ public enum Pragma {
JDBC_EXPLICIT_READONLY(
"jdbc.explicit_readonly", "Set explicit read only transactions", null);



public final String pragmaName;
public final String[] choices;
public final String description;
Expand All @@ -560,19 +562,19 @@ public enum Pragma {
this.choices = choices;
}

/**
* Convert the given enum values to a string array
*
* @param list Array if PragmaValue.
* @return String array of Enum values
*/
private static String[] toStringArray(PragmaValue[] list) {
String[] result = new String[list.length];
for (int i = 0; i < list.length; i++) {
result[i] = list[i].getValue();
}
return result;
}
/**
* Convert the given enum values to a string array
*
* @param list Array if PragmaValue.
* @return String array of Enum values
*/
private static String[] toStringArray(PragmaValue[] list) {
String[] result = new String[list.length];
for (int i = 0; i < list.length; i++) {
result[i] = list[i].getValue();
}
return result;
}

public final String getPragmaName() {
return pragmaName;
Expand Down Expand Up @@ -719,7 +721,6 @@ private static interface PragmaValue {
public String getValue();
}


public enum Encoding implements PragmaValue {
UTF8("'UTF-8'"),
UTF16("'UTF-16'"),
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/org/sqlite/SQLiteConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;

import org.junit.jupiter.api.Test;
import org.sqlite.SQLiteConfig.Pragma;

Expand Down

0 comments on commit 3faf3d3

Please sign in to comment.