xo / usql

Universal command-line interface for SQL databases
MIT License
8.82k stars 346 forks source link

Use scan types reported by driver when scanning values for copy #376

Closed nineinchnick closed 1 year ago

nineinchnick commented 1 year ago

This should be more correct than relying on a driver to properly handle an empty interface. I checked how the type is used in go/1.19.1/libexec/src/database/sql/sql_test.go.

kenshaw commented 1 year ago

@nineinchnick Is this at least of equal performance? I had originally / purposefully avoided using reflect due to performance concerns.

nineinchnick commented 1 year ago

It's done only once when executing the query. I can write a benchmark for copy, we sure would use some.