Skip to content

Commit

Permalink
Handle nullable columns for databases using pointers
Browse files Browse the repository at this point in the history
Some databases (e.g. clickhouse) is using pointer values to represent
nullable values when querying from the database. The current logic to
transform values to strings when querying data, does not handle this
correctly. It will simply transform the pointer to a string, which
results in the pointer address being printed.

To handle this, the value reported from the sql driver will now tried to
be extracted, if it is a pointer. This means the value of the pointer
will then be transformed to a string, instead of the pointer directly.

Additionally, some cases where this was causing issues in the clickhouse
implementation have been fixed.

Fixes sqls-server#151
  • Loading branch information
patrickpichler committed Apr 30, 2024
1 parent eb695ac commit ff86f30
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 67 deletions.
28 changes: 14 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/denisenkom/go-mssqldb v0.12.3
github.com/go-sql-driver/mysql v1.7.1
github.com/godror/godror v0.41.0
github.com/google/go-cmp v0.5.9
github.com/google/go-cmp v0.6.0
github.com/jackc/pgx/v4 v4.18.1
github.com/jfcote87/sshdb v0.5.3
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
Expand All @@ -18,26 +18,26 @@ require (
)

require (
github.com/ClickHouse/clickhouse-go/v2 v2.23.2
github.com/k0kubun/pp v3.0.1+incompatible
github.com/mattn/go-sqlite3 v1.14.19
github.com/olekukonko/tablewriter v0.0.5
github.com/vertica/vertica-sql-go v1.3.3
)

require (
github.com/ClickHouse/ch-go v0.58.2 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.17.1 // indirect
github.com/andybalholm/brotli v1.0.6 // indirect
github.com/ClickHouse/ch-go v0.61.5 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/elastic/go-sysinfo v1.11.2 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.6.1 // indirect
github.com/go-faster/errors v0.7.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/godror/knownpb v0.1.1 // indirect
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
Expand All @@ -46,26 +46,26 @@ require (
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
github.com/jackc/pgtype v1.14.0 // indirect
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/paulmach/orb v0.10.0 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/paulmach/orb v0.11.1 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/xrash/smetrics v0.0.0-20231213231151-1d8dd44e695e // indirect
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
go.opentelemetry.io/otel v1.26.0 // indirect
go.opentelemetry.io/otel/trace v1.26.0 // indirect
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
howett.net/plist v1.0.1 // indirect
)
Loading

0 comments on commit ff86f30

Please sign in to comment.