Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

database/sql: way to execute the SQL directly without prepare for IBM/DB2 #37014

Closed
akhilravuri1 opened this issue Feb 4, 2020 · 6 comments
Closed

Comments

@akhilravuri1
Copy link

@akhilravuri1 akhilravuri1 commented Feb 4, 2020

What version of Go are you using (go version)?

$ go version
go version go1.13.4 windows/amd64

Does this issue reproduce with the latest release?

NO

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\rakhil\AppData\Local\go-build
set GOENV=C:\Users\rakhil\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\rakhil\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\rakhil\AppData\Local\Temp\go-build747585790=/tmp/go-build -gno-record-gcc-switches

What did you do?

I was trying to create a view in the BIGSQL database by IBM using the go_ibm_db package which is based on your database/sql package but it was not created because your database/sql uses prepare and query API's even if we call exec. But for creating a view and altering table BIGSQL throws an error if we use prepare and query instead of execdirect.

What did you expect to see?

view is created and the table is altered successfully.

What did you see instead?

BIGSQL returns statement not supported.

Do you have any plans for supporting ExecDirect api?

Thanks,
Akhil

@agnivade
Copy link
Contributor

@agnivade agnivade commented Feb 4, 2020

Hello @akhilravuri1 - could you please fill the issue template entirely explaining what is it that you are trying to do ? A self-contained independant code sample is preferred.

@akhilravuri1
Copy link
Author

@akhilravuri1 akhilravuri1 commented Feb 5, 2020

Hi @agnivade

Sorry, I have modified my comment.

Thanks,
Akhil

@agnivade agnivade changed the title way to execute the SQL directly without prepare database/sql: way to execute the SQL directly without prepare for IBM/DB2 Feb 5, 2020
@agnivade
Copy link
Contributor

@agnivade agnivade commented Feb 5, 2020

@kardianos
Copy link
Contributor

@kardianos kardianos commented Feb 5, 2020

Looking at https://github.com/ibmdb/go_ibm_db it looks like the driver doesn't implement the driver.Queryer interface. Once that is implemented, it will operate as desired.

@kardianos
Copy link
Contributor

@kardianos kardianos commented Feb 5, 2020

It looks like that above driver uses ODBC3 to implement connections. There may be a limitation there. Furthermore, it looks like it has a dedicated API call to create or drop tables.

The issue isn't with database/sql, but likely with your driver.

@kardianos kardianos closed this Feb 5, 2020
@akhilravuri1
Copy link
Author

@akhilravuri1 akhilravuri1 commented Feb 6, 2020

Hi @kardianos
Thanks for the information about the driver.Queryer interface.

Akhil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.