Skip to content

Commit

Permalink
add statement type to api
Browse files Browse the repository at this point in the history
  • Loading branch information
jraymakers committed Oct 11, 2024
1 parent 1ef3e14 commit 6396e66
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 0 additions & 1 deletion api/src/DuckDBExtractedStatements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ export class DuckDBExtractedStatements {
)
);
}
// TODO
}
5 changes: 5 additions & 0 deletions api/src/DuckDBPreparedStatement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { DuckDBPendingResult } from './DuckDBPendingResult';
import { DuckDBResult } from './DuckDBResult';
import { DuckDBTypeId } from './DuckDBTypeId';

type StatementType = duckdb.StatementType;

export class DuckDBPreparedStatement {
private readonly prepared_statement: duckdb.PreparedStatement;
constructor(prepared_statement: duckdb.PreparedStatement) {
Expand All @@ -11,6 +13,9 @@ export class DuckDBPreparedStatement {
public dispose() {
duckdb.destroy_prepare(this.prepared_statement);
}
public get statementType(): StatementType {
return duckdb.prepared_statement_type(this.prepared_statement);
}
public get parameterCount(): number {
return duckdb.nparams(this.prepared_statement);
}
Expand Down
11 changes: 11 additions & 0 deletions api/src/DuckDBResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { DuckDBLogicalType } from './DuckDBLogicalType';
import { DuckDBType } from './DuckDBType';
import { DuckDBTypeId } from './DuckDBTypeId';

type ResultReturnType = duckdb.ResultType;
type StatementType = duckdb.StatementType;

export type { ResultReturnType, StatementType };

export class DuckDBResult {
private readonly result: duckdb.Result;
constructor(result: duckdb.Result) {
Expand All @@ -12,6 +17,12 @@ export class DuckDBResult {
public dispose() {
duckdb.destroy_result(this.result);
}
public get returnType(): ResultReturnType {
return duckdb.result_return_type(this.result);
}
public get statementType(): StatementType {
return duckdb.result_statement_type(this.result);
}
public get columnCount(): number {
return duckdb.column_count(this.result);
}
Expand Down

0 comments on commit 6396e66

Please sign in to comment.