Questions tagged [sqlite.swift]

A third-party, type-safe, Swift-language layer over SQLite.

A third-party, type-safe, Swift-language layer over SQLite.

Related tags:

,

References:

252 questions
39
votes
4 answers

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…
Renato Parreira
  • 838
  • 1
  • 7
  • 23
8
votes
1 answer

SQLite.swift pod: Swift Compiler Error in Xcode 8.3 beta 2

Project builds fine in Xcode 8.2.1, but in 8.3b2 the pod SQLite.swift produces >18 issues like: Swift Compiler Error Build a shadowed submodule 'Darwin.POSIX.basic' module.modulemap Errors appear to relate to redefinition of basic types such…
Zaq
  • 1,071
  • 2
  • 10
  • 19
8
votes
2 answers

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…
Fattie
  • 27,874
  • 70
  • 431
  • 719
8
votes
2 answers

How do I check if a column exist before adding it

I have a db, and I want to add a column to it if it doesn't exist. How do I do that with sqlite.swift API?
user2496373
  • 105
  • 2
  • 8
8
votes
1 answer

SQLite.swift: Best way to implement model classes representing rows of a given table?

This is only question I've asked (so far) that doesn't need much/any explanation. I had got as far as this with solving it: each class might have an initialiseTable() kind of like function which would be called when the DB schema is…
kylejs
  • 1,128
  • 11
  • 25
7
votes
2 answers

How can i resolve warning message 'BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation' in Sqlite.swift?

i'm using Sqlite.swift when i restart app in simulator, i want to remove existing database and make new database. (because of initializing database... i change the database column a lot.) but there is warning message. [logging] BUG IN CLIENT OF…
doori
  • 85
  • 1
  • 6
7
votes
1 answer

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]!)") //…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
7
votes
1 answer

How to update or insert with SQLite.swift

I want to update the column of a row if the row already exists, but if it doesn't exist yet then I want to insert a new row. Related questions This type of question is popular for SQL in general UPDATE if exists else INSERT in SQL Server…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
7
votes
0 answers

Bulk insert with SQLite.swift, performant way?

I'm trying to do a bulk insert with SQLite Swift. However, I'm not 100% sure if my code is correct. The Swift code I've settled on (because it delivered the best performance timewise) is: do { try DB.transaction { () -> Void in for index in…
swennemen
  • 945
  • 1
  • 14
  • 24
6
votes
2 answers

Retrieving a column from SQLite to a label in cell of table view Swift iOS

I am retrieving all the values of column formname to a titleLabel in a cell of a tableview, but unfortunately I am facing these two errors Call can throw, but it is not marked with 'try' and the error is not handled and this Call can throw, but…
iOS Developer
  • 311
  • 4
  • 25
6
votes
1 answer

No need to create an index on a column with a UNIQUE constraint, right?

I have a table with three columns. _id (primary key) word (unique) frequency In SQLite.swift I create the table like this try db.run( userDictionary.create(ifNotExists: true) {t in t.column(wordId, primaryKey: true) t.column(word,…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
6
votes
3 answers

Do I need to "close" a connection in SQLite.swift?

Not sure about whether I should and how to close a Connection in SQLite.swift. Will it cause thread/memory leak?
henrichen
  • 226
  • 2
  • 5
5
votes
0 answers

Can I use SQLite.swift's Codable functionality with enums?

I'm trying to use SQLite.swift's Codable functionality to insert a row, but am getting the following error message: Swift.EncodingError.Context(codingPath: [], debugDescription: "Top-level MyEnum encoded as number JSON fragment.", underlyingError:…
Neil Mountford
  • 1,951
  • 3
  • 21
  • 31
5
votes
1 answer

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…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
5
votes
2 answers

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.…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
1
2 3
16 17