Skip to content

Commit

Permalink
Merge with xerial/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Willena committed Nov 30, 2024
2 parents 8c9c6a1 + 27cbdc0 commit 700eaf9
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
= SQLite JDBC Driver
:project-version: 3.47.0.0
:project-version: 3.47.1.0

image:https://img.shields.io/github/actions/workflow/status/willena/sqlite-jdbc-crypt/ci.yml?branch=master[GitHub Workflow Status (branch),link=https://github.com/willena/sqlite-jdbc/actions/workflows/ci.yml?query=branch%3Amaster]
image:https://maven-badges.herokuapp.com/maven-central/io.github.willena/sqlite-jdbc/badge.svg[Maven Central,link=https://maven-badges.herokuapp.com/maven-central/io.github.willena/sqlite-jdbc/]
Expand Down
6 changes: 3 additions & 3 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version=3.47.0
artifactVersion=3.47.0.0
sqliteMCVersion=1.9.0
version=3.47.1
artifactVersion=3.47.1.0-SNAPSHOT
sqliteMCVersion=1.9.1
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.willena</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.47.0.0</version>
<version>3.47.1.0-SNAPSHOT</version>
<name>SQLite JDBC</name>
<description>SQLite JDBC library with encryption and authentication support</description>
<url>https://github.com/Willena/sqlite-jdbc-crypt</url>
Expand Down Expand Up @@ -197,7 +197,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.17.1</version>
<version>2.18.0</version>
</plugin>

<plugin>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/sqlite/ExtendedCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static String removeQuotation(String s) {
if (s == null) return s;

if ((s.startsWith("\"") && s.endsWith("\"")) || (s.startsWith("'") && s.endsWith("'")))
return s.substring(1, s.length() - 1);
return (s.length() >= 2) ? s.substring(1, s.length() - 1) : s;
else return s;
}

Expand Down
22 changes: 22 additions & 0 deletions src/test/java/org/sqlite/ExtendedCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.sql.SQLException;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.sqlite.ExtendedCommand.BackupCommand;
import org.sqlite.ExtendedCommand.RestoreCommand;
import org.sqlite.ExtendedCommand.SQLExtension;
Expand Down Expand Up @@ -69,4 +73,22 @@ public void parseRestoreCmd() throws SQLException {
assertThat(b.targetDB).isEqualTo("main");
assertThat(b.srcFile).isEqualTo("target/sample.db");
}

@ParameterizedTest
@MethodSource
public void removeQuotation(String input, String expected) throws SQLException {
assertThat(ExtendedCommand.removeQuotation(input)).isEqualTo(expected);
}

private static Stream<Arguments> removeQuotation() {
return Stream.of(
Arguments.of(null, null), // Null String
Arguments.of("'", "'"), // String with one single quotation only
Arguments.of("\"", "\""), // String with one double quotation only
Arguments.of("'Test\"", "'Test\""), // String with two mismatch quotations
Arguments.of("'Test'", "Test"), // String with two matching single quotations
Arguments.of("\"Test\"", "Test"), // String with two matching double quotations
Arguments.of("'Te's\"t'", "Te's\"t") // String with more than two quotations
);
}
}

0 comments on commit 700eaf9

Please sign in to comment.