mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
Add debugging logs
This commit is contained in:
parent
f8cc08e5ad
commit
fb2b5eb11f
2 changed files with 14 additions and 1 deletions
|
@ -3,6 +3,8 @@ package org.github.tursodatabase.core;
|
|||
import java.sql.SQLException;
|
||||
|
||||
import org.github.tursodatabase.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* A table of data representing limbo database result set, which is generated by executing a statement that queries the
|
||||
|
@ -13,12 +15,14 @@ import org.github.tursodatabase.annotations.Nullable;
|
|||
*/
|
||||
public class LimboResultSet {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(LimboResultSet.class);
|
||||
|
||||
private final LimboStatement statement;
|
||||
|
||||
// Whether the result set does not have any rows.
|
||||
private boolean isEmptyResultSet = false;
|
||||
// If the result set is open. Doesn't mean it has results.
|
||||
private boolean open = false;
|
||||
private boolean open;
|
||||
// Maximum number of rows as set by the statement
|
||||
private long maxRows;
|
||||
// number of current row, starts at 1 (0 is used to represent loading data)
|
||||
|
@ -55,11 +59,15 @@ public class LimboResultSet {
|
|||
}
|
||||
|
||||
lastStepResult = this.statement.step();
|
||||
log.debug("lastStepResult: {}", lastStepResult);
|
||||
if (lastStepResult.isRow()) {
|
||||
row++;
|
||||
}
|
||||
|
||||
pastLastRow = lastStepResult.isDone();
|
||||
if (pastLastRow) {
|
||||
open = false;
|
||||
}
|
||||
return !pastLastRow;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import java.sql.SQLException;
|
|||
import org.github.tursodatabase.annotations.NativeInvocation;
|
||||
import org.github.tursodatabase.annotations.Nullable;
|
||||
import org.github.tursodatabase.utils.LimboExceptionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* By default, only one <code>resultSet</code> object per <code>LimboStatement</code> can be open at the same time.
|
||||
|
@ -13,6 +15,8 @@ import org.github.tursodatabase.utils.LimboExceptionUtils;
|
|||
* implicitly close the current <code>resultSet</code> object of the statement if an open one exists.
|
||||
*/
|
||||
public class LimboStatement {
|
||||
private static final Logger log = LoggerFactory.getLogger(LimboStatement.class);
|
||||
|
||||
private final String sql;
|
||||
private final long statementPointer;
|
||||
private final LimboResultSet resultSet;
|
||||
|
@ -22,6 +26,7 @@ public class LimboStatement {
|
|||
this.sql = sql;
|
||||
this.statementPointer = statementPointer;
|
||||
this.resultSet = LimboResultSet.of(this);
|
||||
log.debug("Creating statement with sql: {}", this.sql);
|
||||
}
|
||||
|
||||
public LimboResultSet getResultSet() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue