Open pingworld opened 3 years ago
@pingworld
Am I right?
You could be correct.
Unfortunately I don't have time to debug your issue. But you can do it yourself.
You did not say what database server you use. I will assume you use MS SQL Server. Then add new test to mssql_test.go that reproduces your issue. And then we can fix it. I am happy to review your PR.
Let me know, if you have any questions.
Thank you.
Alex
https://github.com/alexbrainman/odbc/blob/f0492dfa15751dfa8566a9eda47542a084908cdb/param.go#L142
when we execute sql like this:
INSERT INTO cy (
addr,
city,
con,
coun,
ctor,
ctime,
ctype,
desc,
don,
emil,
id,
in_type,
lo,
mtme,
ne,
phe,
pal,
pe,
sale,
tus,
wie) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
_, err = st.Exec("", "", "", "", 0, 16144, "genal", "", "", "", 62199, "", "", 1614, "testtest", "", "", "", 0, "ace", "")
then we got a panic:
After debuging, we found it would be panic when our param
addr
is empty which type is[]byte
.We dig the source code and found this code should raise
out of range
exception.So we fix this just like this:
Am I right?
Thanks for your response.