Skip to main content

I've implemented this very easysimple func:

func convap (text : String) -> String { return text.stringByReplacingOccurrencesOfString("'", withString: "''") } 

So you can write:

let sqlQuery = "INSERT INTO myTable (Field1, Field2) VALUES ('\(convap(value1))','\(convap(value2)') 

I've implemented this very easy func:

func convap (text : String) -> String { return text.stringByReplacingOccurrencesOfString("'", withString: "''") } 

So you can write:

let sqlQuery = "INSERT INTO myTable (Field1, Field2) VALUES ('\(convap(value1))','\(convap(value2)') 

I've implemented this very simple func:

func convap (text : String) -> String { return text.stringByReplacingOccurrencesOfString("'", withString: "''") } 

So you can write:

let sqlQuery = "INSERT INTO myTable (Field1, Field2) VALUES ('\(convap(value1))','\(convap(value2)') 
Source Link
Blasco73
  • 3k
  • 2
  • 26
  • 31

I've implemented this very easy func:

func convap (text : String) -> String { return text.stringByReplacingOccurrencesOfString("'", withString: "''") } 

So you can write:

let sqlQuery = "INSERT INTO myTable (Field1, Field2) VALUES ('\(convap(value1))','\(convap(value2)')