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

string type : sql: converting argument $1 type: invalid type given #16

Open
l-we opened this issue May 9, 2020 · 8 comments
Open

string type : sql: converting argument $1 type: invalid type given #16

l-we opened this issue May 9, 2020 · 8 comments
Labels
help wanted Extra attention is needed IQ

Comments

@l-we
Copy link

l-we commented May 9, 2020

	"database/sql"

	_ "github.com/thda/tds"
)

func main() {
	cnxStr := "tds://my_user:my_password@dbhost.com:5000/pubs?charset=utf8"
	db, err := sql.Open("tds", cnxStr)
	if err != nil {
		log.Fatal(err)
	}

	id := "1"
	rows, err := db.Query("select * from authors where id = ?", id)
	…
}
@thda
Copy link
Owner

thda commented May 12, 2020

Hi,

I've published a fix in the relax-int-types branch.
Can you please let me know if it works for you?

Thanks

@l-we
Copy link
Author

l-we commented May 13, 2020

No, My table
id varchar(255)

@thda
Copy link
Owner

thda commented May 13, 2020

Could you please give the the output of: select @@version

please ?

@l-we
Copy link
Author

l-we commented May 13, 2020

SAP IQ/16.0.110.2707/10870/P/sp11.18 INSTRUMENTED/Enterprise Linux64 - x86_64 - 2.6.18-194.el5/64bit/2018-08-03 01:59:49

@thda
Copy link
Owner

thda commented May 24, 2020

Thanks. I will update the readme stating that prepared statement do not work with IQ.
I do not have access to sybase iq anymore, as my company has stopped using it.

@thda thda added IQ help wanted Extra attention is needed labels May 24, 2020
@thda
Copy link
Owner

thda commented May 24, 2020

Do you know where I can find a docker image with IQ ?

@l-we
Copy link
Author

l-we commented May 27, 2020

rows, err := db.Query(`select * from authors where id = '` + id + `' `)

is ok

@ISim
Copy link

ISim commented Sep 16, 2020

Hi all,
unfortunately I have to work with very old sybase (select @@Version shows ver: 12.0.1.3827). I've tried pure go driver github.com/SAP/go-ase, but this doesn't support encryption methods below TDS_MSG_SEC_ENCRYPT4. So I was glad to find this driver but I ran into the same bug:

err := db.QueryRow("select name from subscriptions where subscriber_name = ?", "A29983").Scan(&name)

hangs up indefinitely. I was a little bit perplexed because

err := db.QueryRow("select name from subscriptions where subscriber_name = 'A29983'").Scan(&name)

works like a charm. I added readTimeout=5 to connection string and after five seconds the error pops up:

sql: converting argument $1 type: invalid type given

The name column type is 'R' and base_type is 'varchar(64)' - according to information retrieved from systabcol

Can I gather another info to help you to fix this bug?

I.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed IQ
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants