mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-06 01:34:21 +01:00
Implement bindXXX functions on rust and java side
This commit is contained in:
@@ -97,14 +97,106 @@ public class LimboStatement {
|
||||
* @throws SQLException if a database access error occurs while retrieving column names
|
||||
*/
|
||||
public void initializeColumnMetadata() throws SQLException {
|
||||
final String[] columnNames = this.columnNames(statementPointer);
|
||||
final String[] columnNames = this.columns(statementPointer);
|
||||
if (columnNames != null) {
|
||||
this.resultSet.setColumnNames(columnNames);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private native String[] columnNames(long statementPointer) throws SQLException;
|
||||
private native String[] columns(long statementPointer) throws SQLException;
|
||||
|
||||
/**
|
||||
* Binds a NULL value to the prepared statement at the specified position.
|
||||
*
|
||||
* @param position The index of the SQL parameter to be set to NULL.
|
||||
* @return <a href="https://www.sqlite.org/c3ref/c_abort.html">Result Codes</a>
|
||||
* @throws SQLException If a database access error occurs.
|
||||
*/
|
||||
public int bindNull(int position) throws SQLException {
|
||||
final int result = bindNull(statementPointer, position);
|
||||
if (result != 0) {
|
||||
throw new SQLException("Exception while binding NULL value at position " + position);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private native int bindNull(long statementPointer, int position) throws SQLException;
|
||||
|
||||
/**
|
||||
* Binds a long value to the prepared statement at the specified position.
|
||||
*
|
||||
* @param position The index of the SQL parameter to be set.
|
||||
* @param value The value to bind to the parameter.
|
||||
* @return <a href="https://www.sqlite.org/c3ref/c_abort.html">Result Codes</a>
|
||||
* @throws SQLException If a database access error occurs.
|
||||
*/
|
||||
public int bindLong(int position, long value) throws SQLException {
|
||||
final int result = bindLong(statementPointer, position, value);
|
||||
if (result != 0) {
|
||||
throw new SQLException("Exception while binding long value at position " + position);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private native int bindLong(long statementPointer, int position, long value) throws SQLException;
|
||||
|
||||
/**
|
||||
* Binds a double value to the prepared statement at the specified position.
|
||||
*
|
||||
* @param position The index of the SQL parameter to be set.
|
||||
* @param value The value to bind to the parameter.
|
||||
* @return <a href="https://www.sqlite.org/c3ref/c_abort.html">Result Codes</a>
|
||||
* @throws SQLException If a database access error occurs.
|
||||
*/
|
||||
public int bindDouble(int position, double value) throws SQLException {
|
||||
final int result = bindDouble(statementPointer, position, value);
|
||||
if (result != 0) {
|
||||
throw new SQLException("Exception while binding double value at position " + position);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private native int bindDouble(long statementPointer, int position, double value)
|
||||
throws SQLException;
|
||||
|
||||
/**
|
||||
* Binds a text value to the prepared statement at the specified position.
|
||||
*
|
||||
* @param position The index of the SQL parameter to be set.
|
||||
* @param value The value to bind to the parameter.
|
||||
* @return <a href="https://www.sqlite.org/c3ref/c_abort.html">Result Codes</a>
|
||||
* @throws SQLException If a database access error occurs.
|
||||
*/
|
||||
public int bindText(int position, String value) throws SQLException {
|
||||
final int result = bindText(statementPointer, position, value);
|
||||
if (result != 0) {
|
||||
throw new SQLException("Exception while binding text value at position " + position);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private native int bindText(long statementPointer, int position, String value)
|
||||
throws SQLException;
|
||||
|
||||
/**
|
||||
* Binds a blob value to the prepared statement at the specified position.
|
||||
*
|
||||
* @param position The index of the SQL parameter to be set.
|
||||
* @param value The value to bind to the parameter.
|
||||
* @return <a href="https://www.sqlite.org/c3ref/c_abort.html">Result Codes</a>
|
||||
* @throws SQLException If a database access error occurs.
|
||||
*/
|
||||
public int bindBlob(int position, byte[] value) throws SQLException {
|
||||
final int result = bindBlob(statementPointer, position, value);
|
||||
if (result != 0) {
|
||||
throw new SQLException("Exception while binding blob value at position " + position);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private native int bindBlob(long statementPointer, int position, byte[] value)
|
||||
throws SQLException;
|
||||
|
||||
/**
|
||||
* Checks if the statement is closed.
|
||||
|
||||
Reference in New Issue
Block a user