Skip to content

dbPrepareString replaces ? and ?? with single quotes #634

@moon91210

Description

@moon91210

Describe the bug

Just like the title says.

To reproduce

local q = con:prepareString('UPDATE users SET `??`=? WHERE `??`=?',
	'nickname',
	'slimshady???',
	'id',
	1
)
con:query(q)

Expected behaviour

I'm not entirely sure if this is done on purpose but I was expecting this in the database:

slimshady???

Reality:

slimshady''

Should I refrain from using dbPrepareString when using question marks in strings?

I thought this function was adding an extra safety measure to prevent sql injections from user input. I didn't expect this behaviour.

Screenshots

Version
1.5.6, win7

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions