Skip to content

What is Arbitrary SQL? #291

@dzpt

Description

@dzpt

I'm a mysql user, and now i'm building a query with your class.
But it still getting error. I really don't understand what Arbitrary SQL is?
In mySQL or msSQL i can simply run a query like:
SELECT * FROM abc WHERE field='text'

I've tried it with your class but now an error occurred everytime.

let stmt = db!.prepare("SELECT COUNT(id) FROM dict WHERE word='?'")
            try stmt.run(inp)
            let count = stmt.scalar() as! Int64

I can't pass parameter (inp) in here.
What are .scalar , .prepare .run ??!

How to put parameter on it? And what if the input value has ' character?
Will it have sql injection?
Why you have to make it difficult to build an query?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions