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
0
votes
1 answer

How to delete .sqlite3 file i.e. the database file in SWIFT?

I'm using SQLite.swift library in my iOS app for database needs. I'm using more than one database with different names. I'm doing it fine no problems. At one point I need to delete the .sqlite3 file i.e., the whole database file when it's no longer…
Praveen Kumar
  • 547
  • 1
  • 7
  • 33
0
votes
1 answer

How to use SQLite in Swift 3.0?

I'm unable to use the SQLite framework in my project. As I'm getting the errors shown in the image. Can anyone help me out to resolve this error. Note: The project is in Swift 3.0 and I have used Cocoapod to install the SQLite library
Jayachandra A
  • 1,335
  • 1
  • 10
  • 21
0
votes
1 answer

remove in print or data Optional() with SQLite.swift

How to remove in print or data Optional() ? (swift3, xcode 8.2.1) let statement = try connection.prepare("SELECT * FROM persons") for data in statement { print(data) } // result print : [Optional(1), Optional("John"),…
user7475694
0
votes
1 answer

Accessing a value from a SQLite.swift array

How do you get at a row of type SQLite.Row using the row number? This is order to populate a picker using the results Array. Thanks var allCountries:Array? let countries = Table("Country") let id = Expression("rowid") let name =…
0
votes
0 answers

Why the sqlite db is encrypted after i start a transaction?

I'm using this code to start a transaction in my actual bd: let stmt = try db.prepare("BEGIN TRANSACTION;") try stmt.run() But after i close the transaction and want to check the db, i can't open it because it's encrypted, and i need a key, but i…
Rogelio Heredia
  • 69
  • 2
  • 10
0
votes
1 answer

Unable to set foreign key SQLite.swift

I am not able to set foreign key using stephencelis SQLite.swift. t.foreignKey(user_id, references:"user_mstr",user_id) I have two tables user_master and user_details. How to set user_id as a foreign key in user_detail table. I am getting below…
VJVJ
  • 435
  • 3
  • 21
0
votes
0 answers

Insert into SQLite database with Swift 3

I am trying to save data into an sqlite database with the below function. func insertSpecieDetail(_ specieId: Int) { // // Create a temporary SpecieDetailModel for storing our values from the query. // let specieDetail:…
David Sanford
  • 735
  • 12
  • 26
0
votes
2 answers

How to print sqlite.swift statement as SQL?

I'm trying to debug some sqlite.swift statements that aren't delivering the results I expect. The documentation shows examples of SQL in comments. for user in try db.prepare(users.select(id, email)) { print("id: \(user[id]), email:…
adamek
  • 2,324
  • 3
  • 24
  • 38
0
votes
1 answer

Error in Singleton usng SQLite Swift

When I am trying to fetch all the data in the SQLite Database in swift using singleton, I get an error in sharedInstance and zero results are fetched. Here is my code: DatabaseManager.swift import SQLite class DatabaseManager { let…
MK DEV
  • 64
  • 10
0
votes
1 answer

Cannot build a subproject using Xcode 8.0 and Swift 3

I'm running Xcode 8.0 build version 8S174q and Apple Swift version 3.0 (swiftlang-800.0.34.6 clang-800.0.33). Pauls-Mac-mini:~ paul$ xcrun xcodebuild -version Xcode 8.0 Build version 8S174q Pauls-Mac-mini:~ paul$ xcrun swift -version Apple Swift…
pbm
  • 5,081
  • 4
  • 18
  • 31
0
votes
1 answer

What to do when error thrown in tableView(_:numberOfRowsInSection:)?

In my iOS app, I have a SQLite database with an items table that has many rows. I'm avoiding loading all of the items into memory and instead only loading the ones being currently shown in the UITableView. I'm using SQLite.swift which can throw when…
Ted Henry
  • 1,442
  • 1
  • 14
  • 34
0
votes
2 answers

ios SQLite.swift project with Swift 3.0

I'm migrating my iOS application to Xcode8 and Swift 3. I updated the dependencies version, everythings looks fine except for the SQLite.swift. In my project on the line "import SQLite" I've this error: "Module compiled with Swift 2.3 cannot be…
Philiz
  • 429
  • 5
  • 25
0
votes
1 answer

Inserting initial data after database creation in SQLite.swift

I have a SQLite database that I want to populate with some initial data. Using SQLite.swift, this method seems to be working: do { let _ = try db.run( userDictionary.create(ifNotExists: false) {t in t.column(wordId, primaryKey: true) …
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
0
votes
1 answer

How to create a filter that does the SQL equivalent of WHERE ... IN for SQLite.Swift

I would like to filter results for the same column with multiple values example in sql: SELECT * FROM myTable WHERE status = 1 AND current_condition = ("New", "Working") this will return all rows from myTable where the status is 1 and the…
stephw
  • 513
  • 1
  • 4
  • 19
0
votes
2 answers

Deleting specific row in table doesn't work, SQLite.Swift, Xcode 7

I want to delete a row with the given value (contactID), which is also the primary key, in SQLite.Swift: let delRowCo = ContactTable.filter(ContactID == contactID) try db.run(delRowCo.delete()) The given contactID surely exists, but it doesn't…
Philipp Januskovecz
  • 868
  • 5
  • 14
  • 25