SQLite Forum

Problem with single quotes Swift/MacOS
Login
Hi folks,

I have trouble to execute a statement with single quotes like this one:
```
rc = sqlite3_prepare_v2(db, "select strftime('%s') as time, int_test from stest", -1, &ppStmt, &pzTail);
```

rc returns 0 but a subsequent
```
let ct = String(cString: sqlite3_column_decltype(ppStmt, cc)).uppercased();
```

runs into 

Unexpectedly found nil while implicitly unwrapping an Optional value

It seems ppStmt is not set on this moment. I could catch it, however, but in the end my SQl would fail.

Replacing the statement to a command without single quotes works fine instead.
Generally there's seems a problem with single quotes of parameters in functions passed by the command in Swift. In the case above a Bind would not work because we're not talking about a Where clause.

Any help appreciate.