arguments in sqlite3_open()
?:
is the ternary operator, explained here.
In this particular instance it's a shortcut way of writing:
int err;if (databasePath) err = sqlite3_open([databasePath fileSystemRepresentation], &db);else err = sqlite3_open(":memory:", &db);if (err != SQLITE_OK) {
But, as I'm sure you'll agree, much more concise.
?
followed by :
is called "Ternary operator".
The line (databasePath ? [databasePath fileSystemRepresentation] : ":memory:")
means:
If databasePath
is true, use [databasePath fileSystemRepresentation]
, else use ":memory:"
.
The line is the one-liner edition of the following:
if(databasePath) { return [databasePath fileSystemRepresentation];} else { return ":memory:";}
:memory:
is In-Memory Database. See the docs for more information.