Giter VIP home page Giter VIP logo

Comments (9)

caibirdme avatar caibirdme commented on July 24, 2024

It is a problem. The current workaround is adding a white space like you said. I'll fix it later. And contribution is welcome😆

from gendry.

caibirdme avatar caibirdme commented on July 24, 2024

@jingyugao In your case:

select {{name}},{{comment}},value from table

I want to know why your select fields are dynamic. Is there any use case that people can't set their select fields?

from gendry.

caibirdme avatar caibirdme commented on July 24, 2024

@jingyugao I found that

The markers in prepared statements are not allowed for identifiers (such as table or column names)

So can you execute select ? from table_a?

from gendry.

caibirdme avatar caibirdme commented on July 24, 2024

In mysql documentation

The markers are legal only in certain places in SQL statements. For example, they are permitted in the VALUES() list of an INSERT statement (to specify column values for a row), or in a comparison with a column in a WHERE clause to specify a comparison value. However, they are not permitted for identifiers (such as table or column names), or to specify both operands of a binary operator such as the = equal sign. The latter restriction is necessary because it would be impossible to determine the parameter type. In general, parameters are legal only in Data Manipulation Language (DML) statements, and not in Data Definition Language (DDL) statements.

from gendry.

jingyugao avatar jingyugao commented on July 24, 2024

The marker is not identifiers. It is variable such as 1,"mysql" and so on.

`package main

import (
"fmt"

_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"

)

func main() {
db, err := sqlx.Connect("mysql", "root:@tcp(127.0.0.1:3306)/db0")
if err != nil {
panic(err)
}
id := []int64{}
db.Select(&id, "select ? from table0", 2)
fmt.Println(id)
}`

from gendry.

jingyugao avatar jingyugao commented on July 24, 2024

190701 8:30:32 4 Connect [email protected] on db0
4 Prepare select ? from table
4 Execute select 2 from table
4 Close stmt

from gendry.

jingyugao avatar jingyugao commented on July 24, 2024

this is the mysql log

from gendry.

caibirdme avatar caibirdme commented on July 24, 2024

Ok,明天上午之前修复这个问题

from gendry.

caibirdme avatar caibirdme commented on July 24, 2024

@jingyugao fixed, see the latest release

from gendry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.