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

The way of string concatenation cannot be detected correctly #1309

Open
wxzkenny opened this issue Feb 26, 2025 · 0 comments
Open

The way of string concatenation cannot be detected correctly #1309

wxzkenny opened this issue Feb 26, 2025 · 0 comments

Comments

@wxzkenny
Copy link

wxzkenny commented Feb 26, 2025

 the code as following:

package main

import (
    "database/sql"
    "fmt"
    _ "github.com/lib/pq"
)

func main() {
    db, err := sql.Open("postgres", "user=postgres password=password dbname=mydb sslmode=disable")
    if err!= nil {
        panic(err)
    }
    defer db.Close()

    var username string
    fmt.Println("请输入用户名:")
    fmt.Scanln(&username)

    var query string = "SELECT * FROM users WHERE username = '" + username + "'"
    rows, err := db.Query(query)
    if err!= nil {
        panic(err)
    }
    defer rows.Close()

    // 处理查询结果
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants