Tag: sqlite.swift

Adding an Xcode subproject: Shouldn't all the source files get copied?

I am manually adding the SQLite.swift subproject to my project. As the directions indicated, I copied the .xcodeproj file to my project. This allows me see all the source files (unlike this SO question). Everything seemed like it was working fine. However, I discovered that the source files of that subproject were not copied to […]

sqlite.swift linked library or also embedded?

I manually installed the SQLite.swift library in my project, following the instructions in the documentation. But there the library will only be linked. It’s running fine in the emulator and I am able to upload it to iTunes connect. When I want to run it directly on my iPad from Xcode I need to embed […]

Using variables in Filters in SQLite.swift

I am using SQLite.swift (Branch Swift-1-2) in my app in XCode 6.3 beta. I am able to create the Database/Tables and insert entries into the tables. So far so good. Now when I have a simple scenario as follows: class Foo { var id: Int? var name: String? /* constructor to create an instance … […]

How to access an FTS table in SQLite.swift using the IN condition

I’m trying to query an FTS table using SQLite.swift. Previously I have done it in Android. The essence of what I am trying to do is this: SELECT * FROM t2 WHERE id IN (SELECT docid FROM fts_table WHERE col_text MATCH ‘something’) From the SQLite.swift documentation I see the IN condition can be written like […]

How to get a list of column names with Sqlite.swift?

For debugging purposes I am trying to get a simple list of the column names in my SQLite table. I am using the SQLite.swift framework. My question is more specific than How to get a list of column names on sqlite3 / iPhone? so I am creating a new question. Using try db.execute(“PRAGMA table_info(table_name);”) by […]

Can I cast Int64 directly into Int?

I’ve been using SQLite.swift lately to build my app database. And I’m defining all my INTEGER columns with a Int64 type, like the documentation explains. But every once in a while I need that Int64 to be just Int. So my question is, if I do this: //Create a table with Int instead of Int64 […]

Getting results from arbitrary SQL statements with correct binding in SQLite.swift

The SQLite.swift documentation says about executing arbitrary SQL: let stmt = try db.prepare(“SELECT id, email FROM users”) for row in stmt { for (index, name) in stmt.columnNames.enumerate() { print (“\(name)=\(row[index]!)”) // id: Optional(1), email: Optional(“alice@mac.com”) } } I wanted to get the values directly like this let stmt = try db.prepare(“SELECT id, email FROM users”) […]

Subtle cast warning when using SQLite.Swift … Binding? to Any

Here’s one, import SQLite var r:[[Any]] = [] do { if let stmt = try local.db?.prepare(q) { r = Array(stmt) } else { print(“woe in sql?”) } } catch { return [] } the call r = Array(stmt) gives Expression implicitly coerced from ‘Binding?’ to Any. And indeed, I do not know how to Provide […]

iOS SQLite.swift, regarding upgrade of app?

Regarding the magnificent and amazing SQLite.swift, I’m wondering You have an app in the app store, v7. There’s an upgrade to v8. User X does upgrade v7 to v8 using the app store. Say in v8, we have slightly changed one of the sql tables, perhaps add a column or rename a column. Should anything […]