diff --git a/bindings/java/src/main/java/org/github/tursodatabase/limbo/Connection.java b/bindings/java/src/main/java/org/github/tursodatabase/limbo/Connection.java deleted file mode 100644 index aaf0f2ca2..000000000 --- a/bindings/java/src/main/java/org/github/tursodatabase/limbo/Connection.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.github.tursodatabase.limbo; - -import java.lang.Exception; - -/** - * Represents a connection to the database. - * TODO: Deprecate classes under limbo package. We leave this source code for reference. - */ -public class Connection { - - // Pointer to the connection object - private final long connectionPtr; - - public Connection(long connectionPtr) { - this.connectionPtr = connectionPtr; - } - - /** - * Creates a new cursor object using this connection. - * - * @return A new Cursor object. - * @throws Exception If the cursor cannot be created. - */ - public Cursor cursor() throws Exception { - long cursorId = cursor(connectionPtr); - return new Cursor(cursorId); - } - - private native long cursor(long connectionPtr); - - /** - * Closes the connection to the database. - * - * @throws Exception If there is an error closing the connection. - */ - public void close() throws Exception { - close(connectionPtr); - } - - private native void close(long connectionPtr); - - /** - * Commits the current transaction. - * - * @throws Exception If there is an error during commit. - */ - public void commit() throws Exception { - try { - commit(connectionPtr); - } catch (Exception e) { - System.out.println("caught exception: " + e); - } - } - - private native void commit(long connectionPtr) throws Exception; - - /** - * Rolls back the current transaction. - * - * @throws Exception If there is an error during rollback. - */ - public void rollback() throws Exception { - rollback(connectionPtr); - } - - private native void rollback(long connectionPtr) throws Exception; -} diff --git a/bindings/java/src/main/java/org/github/tursodatabase/limbo/Cursor.java b/bindings/java/src/main/java/org/github/tursodatabase/limbo/Cursor.java deleted file mode 100644 index eaec47f04..000000000 --- a/bindings/java/src/main/java/org/github/tursodatabase/limbo/Cursor.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.github.tursodatabase.limbo; - -/** - * Represents a database cursor. - * TODO: Deprecate classes under limbo package. We leave this source code for reference. - */ -public class Cursor { - private long cursorPtr; - - public Cursor(long cursorPtr) { - this.cursorPtr = cursorPtr; - } - - // TODO: support parameters - public Cursor execute(String sql) { - var result = execute(cursorPtr, sql); - System.out.println("resut: " + result); - return this; - } - - private static native int execute(long cursorPtr, String sql); - - public Object fetchOne() throws Exception { - Object result = fetchOne(cursorPtr); - return processSingleResult(result); - } - - private static native Object fetchOne(long cursorPtr); - - public Object fetchAll() throws Exception { - Object result = fetchAll(cursorPtr); - return processArrayResult(result); - } - - private static native Object fetchAll(long cursorPtr); - - private Object processSingleResult(Object result) throws Exception { - if (result instanceof Object[]) { - System.out.println("The result is of type: Object[]"); - for (Object element : (Object[]) result) { - printElementType(element); - } - return result; - } else { - printElementType(result); - return result; - } - } - - private Object processArrayResult(Object result) throws Exception { - if (result instanceof Object[][]) { - System.out.println("The result is of type: Object[][]"); - Object[][] array = (Object[][]) result; - for (Object[] row : array) { - for (Object element : row) { - printElementType(element); - } - } - return array; - } else { - throw new Exception("result should be of type Object[][]. Maybe internal logic has error."); - } - } - - private void printElementType(Object element) { - if (element instanceof String) { - System.out.println("String: " + element); - } else if (element instanceof Integer) { - System.out.println("Integer: " + element); - } else if (element instanceof Double) { - System.out.println("Double: " + element); - } else if (element instanceof Boolean) { - System.out.println("Boolean: " + element); - } else if (element instanceof Long) { - System.out.println("Long: " + element); - } else if (element instanceof byte[]) { - System.out.print("byte[]: "); - for (byte b : (byte[]) element) { - System.out.print(b + " "); - } - System.out.println(); - } else { - System.out.println("Unknown type: " + element); - } - } -} diff --git a/bindings/java/src/main/java/org/github/tursodatabase/limbo/Limbo.java b/bindings/java/src/main/java/org/github/tursodatabase/limbo/Limbo.java deleted file mode 100644 index 941ec4656..000000000 --- a/bindings/java/src/main/java/org/github/tursodatabase/limbo/Limbo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.github.tursodatabase.limbo; - -import org.github.tursodatabase.exceptions.ErrorCode; - -import java.lang.Exception; - -/** - * TODO: Deprecate classes under limbo package. We leave this source code for reference. - */ -public class Limbo { - - private static volatile boolean initialized; - - private Limbo() { - if (!initialized) { - System.loadLibrary("_limbo_java"); - initialized = true; - } - } - - public static Limbo create() { - return new Limbo(); - } - - public Connection getConnection(String path) throws Exception { - long connectionId = connect(path); - if (connectionId == ErrorCode.CONNECTION_FAILURE) { - throw new Exception("Failed to initialize connection"); - } - return new Connection(connectionId); - } - - private static native long connect(String path); -}