Skip to content

Commit 59c04b6

Browse files
Using latest v2 binaries that include the new rawExcelSQL call on the SQLiteDatabase
1 parent fc1dec9 commit 59c04b6

File tree

7 files changed

+119
-69
lines changed

7 files changed

+119
-69
lines changed
256 Bytes
Binary file not shown.
6.51 KB
Binary file not shown.

libs/sqlcipher.jar

210 Bytes
Binary file not shown.

net.zetetic.sqlcipher.test.iws

Lines changed: 68 additions & 69 deletions
Large diffs are not rendered by default.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package net.zetetic.tests;
2+
3+
import net.sqlcipher.database.SQLiteDatabase;
4+
5+
public class RawExecSQLExceptionTest extends SQLCipherTest {
6+
7+
@Override
8+
public boolean execute(SQLiteDatabase database) {
9+
10+
try{
11+
database.rawExecSQL("select foo from bar");
12+
}catch (Exception e){
13+
return true;
14+
}
15+
return false;
16+
}
17+
18+
@Override
19+
public String getName() {
20+
return "rawExecSQL Exception Test";
21+
}
22+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package net.zetetic.tests;
2+
3+
import android.database.Cursor;
4+
import net.sqlcipher.database.SQLiteDatabase;
5+
6+
public class RawExecSQLTest extends SQLCipherTest {
7+
@Override
8+
public boolean execute(SQLiteDatabase database) {
9+
10+
String actual = "";
11+
String value = "hey";
12+
database.rawExecSQL("create table t1(a)");
13+
database.execSQL("insert into t1(a) values (?)", new Object[]{value});
14+
Cursor result = database.rawQuery("select * from t1", new String[]{});
15+
if(result != null){
16+
result.moveToFirst();
17+
actual = result.getString(0);
18+
result.close();
19+
}
20+
return actual.equals(value);
21+
}
22+
23+
@Override
24+
public String getName() {
25+
return "rawExecSQL Test";
26+
}
27+
}

src/main/java/net/zetetic/tests/TestSuiteRunner.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ private List<SQLCipherTest> getTestsToRun(){
4646
tests.add(new LoopingCountQueryTest());
4747
tests.add(new AttachDatabaseTest());
4848
tests.add(new CanThrowSQLiteExceptionTest());
49+
tests.add(new RawExecSQLTest());
50+
tests.add(new RawExecSQLExceptionTest());
4951
return tests;
5052
}
5153
}

0 commit comments

Comments
 (0)