oven-sh/bun

Getting column-type information from a statement/query

Closed

#7,134 opened on Nov 15, 2023

 (4 comments) (0 reactions) (1 assignee)Rust (4,486 forks)batch import
bun.jsbun:sqliteenhancementgood first issue

Repository metrics

Stars
 (90,348 stars)
PR merge metrics
 (Avg merge 1d 17h) (357 merged PRs in 30d)

Description

What is the problem this feature would solve?

I would like more information about the columns the will be returned from a statement, right now I can only get the columnName but more info like the one we can get from better-sqlite would be nice.

Stolen from their docs:

.name: the name (or alias) of the result column.
.column: the name of the originating table column, or null if it's an expression or subquery.
.table: the name of the originating table, or null if it's an expression or subquery.
.database: the name of the originating database, or null if it's an expression or subquery.
.type: the name of the [declared type](https://www.sqlite.org/datatype3.html#determination_of_column_affinity), or null if it's an expression or subquery.

https://github.com/WiseLibs/better-sqlite3/blob/HEAD/docs/api.md#columns---array-of-objects

What is the feature you are proposing to solve the problem?

We are wanna do some automagic formatting of the result based the column type. And yes, I'm aware there is only like 5 datatypes and that they can be mixed.

What alternatives have you considered?

Using better-sqlite3 instead of buns built in variant.

https://github.com/WiseLibs/better-sqlite3/blob/HEAD/docs/api.md#columns---array-of-objects

Contributor guide