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
1
vote
1 answer

Cordova SQLite Plugin Compatibility

I'm looking to build an iOS hybrid application that also utilizes an Apple Watch application. The watchOS app collects Altimeter data to be stored, and that's it. I was thinking of using this plugin since the watchOS portion is written in Swift. I…
iamjake648
  • 13
  • 1
  • 4
1
vote
1 answer

Create index over multiple columns in sqlite.swift

I updated sqlite.swift to version 0.11.4, and my compiler repots an error when I create index including two columns. Before I was using command try db.run(table.createIndex([column1, column2], unique: true, ifNotExists: true)) After update, it…
finder
  • 125
  • 1
  • 12
1
vote
1 answer

Is sqlite.swift threadsafe?

Is it possible to use sqlite.swift from multiple threads (read/write same table). I tried to determine it from from build setting - but did not found SERIALIZED, MULTITHREAD or THREADSAFE words. Does it use original sqlite3 C library under the hood?…
denys
  • 2,437
  • 6
  • 31
  • 55
1
vote
1 answer

sqlite.swift how to do subquery

I'm attempting a query to get the latest N messages in a particular conversation from a table of messages. I think this is the correct sql: select * from (select * from messages where convoId = to order by timestamp DESC limit 10) order by timestamp…
rclark
  • 301
  • 3
  • 13
1
vote
1 answer

Sqlite.swift Get Row Value

I have my query set as such: let query = devices.count And in order to print the results I have the following: let results = try! db.prepare(query) for items in results { print (items) } The output…
Martheli
  • 931
  • 1
  • 16
  • 35
1
vote
1 answer

It's possible to use date functions like "strftime"?

I tried to create a expression like this let performedDate = Expression("strftime('%Y-%m-%d', performedDate)") and then compare with another string using filter method. But the generated SQL is "strftime('%Y-%m-%d', performedDate)" =…
1
vote
2 answers

SQLite.Swift Expression() initialization for "not null" form?

Please note that this question ONLY relates to the popular SQLite.swift library, stephencelis/SQLite.swift With SQLite.swift you can let a = Expression("a") let b = Expression("b") and so on. But how do you select a.x, a.y,…
Fattie
  • 27,874
  • 70
  • 431
  • 719
1
vote
0 answers

How to create a Sqlite table with OnConflict constraint on a primary or unique column Using SQLite.swift Library for iOS ?

I am new to iOS with android background. and after quite sometime searching how to persist data for my project I chose to use SQLite.swift Library by stephencelis. Now, I want to do a simple Table creation: CREATE TABLE IF NOT EXISTS TableName…
Pomanh
  • 640
  • 9
  • 14
1
vote
1 answer

How to use "start of month" sqlite date modifier using SQLite.swift

Sorry that I can't post any code but I don't even know where to start trying to code this statement using SQLite.swift, I have searched and searched but not found anything that could help: Edit: (I am trying to avoid RAW SQL but if no option will…
zzpaf
  • 73
  • 7
1
vote
0 answers

Best way to return joined table in Sqlite.swift

The following code works perfectly and I get exactly what I need, but I'm curious if there is a better way to return a joined table. If you look below, how much code I need to write for the joined "Address" table. I was hoping someone can confirm…
Primico
  • 2,143
  • 3
  • 24
  • 36
1
vote
1 answer

How to insert into Sqlite with optional parameters using Swift 3

I have this class with some optional properties: class Address { var Id: Int64 var AddressType: Int64 var AddressStatus: Int64 var Address1: String? var Address2: String? var City: String? var State: String? var Zip:…
Primico
  • 2,143
  • 3
  • 24
  • 36
1
vote
0 answers

SQLite.swift Create an Array of Column Expressions

Is it possible to create an array of column expressions using SQLite.swift? static let COLUMN_PARTNER_ID = Expression(COLUMN_NAME_PARTNER_ID) static let COLUMN_COMPANY_ID = Expression(COLUMN_NAME_COMPANY_ID) static let COLUMN_USER_ID…
rfranczyk
  • 33
  • 6
1
vote
2 answers

SQLite.swift (Release 0.11.2) sample code is not working

I am trying to use SQLite.swift sample code but it is throwing an error. First step I have done is to install it using cocoapods and it was successful. Then I have tried to test it in my app delegate where I declare import SQLite and I have added…
1
vote
2 answers

In the sqlite.swift framework is there a way to prepare the statement once ahead of time and then bind the variable just before execution?

I use SQLite for my persistent store. I use a dictionary based off the primary key for an in-memory store: var localContext = [String: GrandLite](). I use the function below to retrieve an object from the dictionary, or from the database and then…
adamek
  • 2,324
  • 3
  • 24
  • 38
1
vote
1 answer

Cannot open a database (new / existing) using SQLite.swift

I have managed to install SQLite.swift (0.18.1) using the "Carthage approach". I can "import SQLite" and do some other stuff, but when I try to open a database, using the following code: let db = try Connection("~/db.sqlite3") and run my program…