Skip to content

Commit 0e781a8

Browse files
committed
hacks
1 parent f5c9e12 commit 0e781a8

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ export declare class Statement {
5353
get(params?: unknown | undefined | null): unknown
5454
iterate(params?: unknown | undefined | null): object
5555
iterateSync(params?: unknown | undefined | null): RowsIterator
56-
pluck(pluck?: boolean | undefined | null): this
5756
raw(raw?: boolean | undefined | null): this
58-
timed(timed?: boolean | undefined | null): this
57+
pluck(pluck?: boolean | undefined | null): this
58+
timing(timed?: boolean | undefined | null): this
5959
columns(): unknown[]
6060
safeIntegers(toggle?: boolean | undefined | null): this
6161
interrupt(): void

integration-tests/tests/extensions.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ test.serial("Statement.run() returning duration", async (t) => {
55
const db = t.context.db;
66

77
const stmt = db.prepare("SELECT 1");
8-
const info = stmt.run();
8+
const info = stmt.timing().run();
99
t.not(info.duration, undefined);
1010
t.log(info.duration)
1111
});
@@ -14,7 +14,7 @@ test.serial("Statement.get() returning duration", async (t) => {
1414
const db = t.context.db;
1515

1616
const stmt = db.prepare("SELECT ?");
17-
const info = stmt.get(1);
17+
const info = stmt.timing().get(1);
1818
t.not(info._metadata?.duration, undefined);
1919
t.log(info._metadata?.duration)
2020
});

src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,14 +1102,11 @@ fn map_row_raw(
11021102
) -> Result<napi::JsUnknown> {
11031103
let column_count = column_names.len();
11041104
let mut js_array = env.create_array(column_count as u32)?;
1105-
1106-
for (idx, _col_name) in column_names.iter().enumerate().take(column_count) {
1105+
for idx in 0..column_count {
11071106
let value = match row.get_value(idx as i32) {
11081107
Ok(v) => v,
11091108
Err(e) => return Err(napi::Error::from_reason(e.to_string())),
11101109
};
1111-
1112-
// Create appropriate JS value based on SQLite value type
11131110
let js_value = match value {
11141111
libsql::Value::Null => env.get_null()?.into_unknown(),
11151112
libsql::Value::Integer(v) => {
@@ -1125,7 +1122,6 @@ fn map_row_raw(
11251122
};
11261123
js_array.set(idx as u32, js_value)?;
11271124
}
1128-
11291125
if pluck {
11301126
let result = match js_array.get::<JsUnknown>(0)? {
11311127
Some(value) => value.into_unknown(),

0 commit comments

Comments
 (0)