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
2 answers

sqlite.swift database table is locked (code:6)

I am trying to create a project that will sync data from an online database. I have 4 files to take care of the whole process: dbConnection.swift createTables.swift dropAllTables.swift updateDatabase.swift I am running into a problem when trying…
Robbie Cronin
  • 1,557
  • 2
  • 10
  • 15
0
votes
1 answer

Sqlite.Swift: Counting number of rows whose column/field value is "x"

I've been working with Sqlite.Swift for quite a while now and I'm stuck. I'm trying to get an Int out of the .count of only the amount of rows containing the String value "1" in the column "yes or no". I've been using the following function to…
Aeger
  • 138
  • 2
  • 11
0
votes
2 answers

Can't convert Expression to Expression

I am using SQLite.swift library. I have several Expressions, let idColumn = Expression("id") let nameColumn = Expression("name") I would like to have a dictionary host them, So, I did: let columns: [String: Expression] = [ …
Leem
  • 17,220
  • 36
  • 109
  • 159
0
votes
1 answer

how to use filter to update row in SQLite.swift library?

I am using SQLite.swift library. I have defined a expression: let id = Expression("id") I have a variable: let num: Int = 1 Then, in update statement I do filtering: let users = Table("User") // compiler error: // Binary operator '=='…
Leem
  • 17,220
  • 36
  • 109
  • 159
0
votes
1 answer

Swift Compiler errors when trying to return a Sqlite.swift query as an array

Trying to get query results into an array. The example from the documentation shows this working... let statement = try db.prepare(query) var results = Array(statement) ...however when I try to compile this I get... Ambiguous use of 'init' ... for…
Kirby Todd
  • 11,254
  • 3
  • 32
  • 60
0
votes
1 answer

Order a column with integers numerical when retrieving data as strings using sqlite database in swift?

I've got a sqlite table with sub_id's, these are stored as strings. When I order with this column, I get my data ordered like this: 1, 10, 13, 16, 2, 23, etc How can I order them numerically? My code: var id = Expression("id") let m_id =…
Albert-Jan
  • 315
  • 1
  • 3
  • 11
0
votes
1 answer

Simple store/retrieve of blob or data (NSKeyArchive of a class maybe)

Experienced developer here... but somewhat new to Swift and definite newbie with SQLite.swift... I am trying to get my hands around using SQLite in an iOS app - so I created a simple app to make sure I got the basics down... Everything was going…
tj4shee
  • 371
  • 1
  • 2
  • 11
0
votes
1 answer

Sqlite.swift missing label "where"

I am using the sqlite.swift library found here Below is the code I am using to filter results: .filter(mdm[assetTag] != "ipad" && location == facility && [tagArray].contains(appversion)) I am getting the following error for the .contains…
Martheli
  • 931
  • 1
  • 16
  • 35
0
votes
0 answers

Crash fetching row value for custom type

I've defined an enum and made it conform to Value like so: enum Name: Int { //cases } extension Name: Value { static var declaredDatatype: String { return Int.declaredDatatype } static func fromDatatypeValue(_ intValue: Int)…
Remco Poelstra
  • 859
  • 6
  • 20
0
votes
2 answers

Project taking too long to build and run after adding complex query

I have integrated SQLite.swift framework in one of my swift project and everything was working fine until i added the below query. After adding the below query project is taking too long to build. I waited for 30 mins but still project is n't…
Developer
  • 822
  • 9
  • 23
0
votes
1 answer

Sqlite Swift Create and Run Query

I have a query built like this: let query = devices.select(assetTag) .order(assetTag.desc) .limit(5, offset: 1) I just do not know which function to use to run it. Do I run it like this: db.execute(query)
Martheli
  • 931
  • 1
  • 16
  • 35
0
votes
1 answer

Can I sync a SQLite.swift database to WatchOS?

I have an application that uses SQLite.swift to save a list of shopping items. It works quite well, and is deeply rooted in the app. But I've been getting asked to make a WatchOS app that has the same items on your wrist. My issue with this, is that…
odonckers
  • 243
  • 1
  • 2
  • 11
0
votes
2 answers

Get last row in swift loop with SQLite.swift

How can I check the last row in this loop below. Im using SQlite.swift in order to cycle through all the rows in the table. When I hit the last row, I want to do something. for data in try dbConnection.prepare(tableName) { if…
plgelso
  • 107
  • 2
  • 15
0
votes
1 answer

sqlite.swift, how to give field value via name?

as the example : for user in try db.prepare(users.select(id, email)) { print("id: (user[id]), email: (user[email])") // id: 1, email: alice@mac.com } // SELECT "id", "email" FROM "users" but I want know if possible use name but expression…
iXcoder
  • 1,564
  • 4
  • 20
  • 41
0
votes
1 answer

redefinition of module 'CSQLite' when i build SQLite.swift

platform :ios, ’10.1’ target 'SwiftDemo' do use_frameworks! pod 'SDWebImage', '~> 4.0.0-beta2' pod 'AFNetworking', '~> 3.1.0' pod 'MJRefresh', '~> 3.1.12' pod 'SQLite.swift', '~> 0.11.3' end this is my podfile, and after i put SQLite.swift into my…