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

Replacing single quotes to double quotes during ? placeholder #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sagar-sandbhor
Copy link

Problem:
existing ? is replaced with single-quoted '' for string variable.

Solution:
We are replacing the ? with double-quoted ("") string variable.

Test:

Test case 1: With wrong password

[nz@anchovy1 script]$ go run test1.go
trying to open...
opened
Search database with name TEST9001
Unable to query :Password authentication failed for user 'ADMIN'
panic: runtime error: invalid memory address or nil pointer dereference
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4ce4ce]

goroutine 1 [running]:
database/sql.(*Rows).close(0x0, {0x0, 0x0})
        /usr/lib/golang/src/database/sql/sql.go:3267 +0x8e
database/sql.(*Rows).Close(0xc00014bbf8)
        /usr/lib/golang/src/database/sql/sql.go:3263 +0x1d
panic({0x62a840, 0x817f20})
        /usr/lib/golang/src/runtime/panic.go:1038 +0x215
database/sql.(*Rows).Next(0x0)
        /usr/lib/golang/src/database/sql/sql.go:2944 +0x27
main.main()
        /nz/script/test1.go:34 +0x4d3
exit status 2

Test case 2: create a database query


[nz@anchovy1 script]$ go run test.go
trying to open...
opened
create a new database with name  TEST90011

single_quote_replace_double_quote.txt
wrong_Password_error_out.txt

@abhishekjog
Copy link
Member

Please file an issue and mention it in the description

Copy link

@aniket-s-kulkarni aniket-s-kulkarni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we cannot change ' to " unconditionally. Lets discuss this solution and then make the change.

Copy link

@aniket-s-kulkarni aniket-s-kulkarni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

@abhishekjog
Copy link
Member

abhishekjog commented Jun 3, 2022

agreed with @aniket-s-kulkarni . that is why asked for issue. single quote cannot be / should not be blindly changed.

Copy link

@aniket-s-kulkarni aniket-s-kulkarni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets hold this up until we complete our discussion

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

Successfully merging this pull request may close these issues.

3 participants