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

SQLite.Swift error : Value of type 'Connection' has no member 'key'

XCode 12.5.1 As title, I got an error. And I use Carthage to install SQLite.swift. SQLite.swift version is 0.13.0 carfile here: github "stephencelis/SQLite.swift" import Foundation import SQLite import SQLCipher let db = try…
Beginnerrrrrr
  • 537
  • 1
  • 8
  • 27
0
votes
0 answers

How to alias selected columns in sqlite swift

I have a query with a column that should be aliased When I try to alias the column, return nil. this is my code : func show() { let cat_table = Table("cat") let id = Expression("id") let cat_text =…
0
votes
0 answers

Sqilte swift multiple query string to filter the sqlite

I have a question about sqlite query. May I use one query string to query my sqlite to get my data? Now I use three query string and it's like so complex It only one query string will match and get the user data. Have any idea to fix it. var…
Beginnerrrrrr
  • 537
  • 1
  • 8
  • 27
0
votes
1 answer

How do I create multiple tables in Swift using SQLite database?

So I was able to do a tutorial to create one table but when I try to create another one, it doesn't show up in the DB Browser for SQLite which makes me think that it is not created. Is there a way to make multiple tables within the same DB…
0
votes
1 answer

How do I Implement SQLite.swift Value Protocol

How do I make my classes comply with the Value Protocol for SQLite.swift so I can add them directly to my database. I have made all of them "Codable" but they need to conform to the Value protocol. Attempt to conform to Value protocol These are the…
Jim
  • 31
  • 3
0
votes
1 answer

Converting app from SQLite.swift to GRDB.swift Second Question

I am continuing the conversion of a number of my apps from SQLite.sift to GRDB.swift. I converted my structs to add Codable, FetchableRecord so as to have them work better with GRDB. This was suggested in a reply to my first post on this…
Quailcreek
  • 125
  • 2
  • 9
0
votes
1 answer

Converting app from SQLite.swift to GRDB.swift

I'm trying to convert several of my apps to use GRDB.swift. Does anybody have or know where I can find a file to get me started? I've read over most of the GRDB docs but I'm not getting it. Below is a sample scenario. This I was able to convert from…
Quailcreek
  • 125
  • 2
  • 9
0
votes
1 answer

How do I avoid build errors when I include SQLCipher pod in Swift project?

I am using sqlite.swift When I include this in my pod file: pod 'SQLite.swift/SQLCipher', '~> 0.12.2' Is SQLCipher still compatible with SQLite.swift? Do I need additional pod statements to import SQLCipher and SQLite or just this one line? XCode…
gregm
  • 12,019
  • 7
  • 56
  • 78
0
votes
1 answer

Connecting SQLite 3 Database to Swift

I'm attempting to open an SQLite3 database in my SwiftUI code, to access the file path within the bundle, I'm using the following function; let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true) …
Diego Gonzalez
  • 113
  • 2
  • 11
0
votes
1 answer

How could I rollback a transaction when throwing custom errors

I have a bulk insert method that attempts to insert an array of items within a transaction. However, I have custom errors I throw based on the values being passed in. For example, strings can not be empty (which is a valid String value for…
CalebDavis
  • 61
  • 4
0
votes
1 answer

Opening and using a database from another view controller

I have created a database in one view controller and I would like to open it and access it in another view controller. I was wondering how to open up a existing database from one view controller in another view controller. I intend to open up the…
0
votes
0 answers

Is there any difference between upper or lower case commands on SQLITE?

My question is if there's any performance difference between: SELECT * FROM mytable vs select * from mytable yes, the whole question is about using reserved words in upper case for better legibility
SidFerreira
  • 551
  • 3
  • 20
0
votes
1 answer

How to call a class only the first time i access an iOS app

I want to create database when i access the app for the first time. As you know, Swift has an AppDelegate.swift class with @UIApplicationMain, and it means main() class. If i want to create database when i first access the app and not the next…
doori
  • 85
  • 1
  • 6
0
votes
1 answer

Is there a SQLite for Swift method for more complex ORDER BY statements?

I have a query similar to the following that I'd like to perform on an sqlite database: SELECT name FROM table WHERE name LIKE "%John%" ORDER BY (CASE WHEN name = "John" THEN 1 WHEN name LIKE "John%" THEN 2 ELSE 3 END),name LIMIT 10 I'd like to…
BLE
  • 161
  • 7
0
votes
2 answers

Problems attaching two sqlite databases with https://cocoapods.org/pods/SQLite.swift

I am using stephencelis/SQLite.swift and try to attach 2 databases at runtime: ATTACH DATABASE \'(databasePath.Local)\' AS LOCAL_USER_DB; // // DatabaseWrapper.swift // ... // import UIKit import SQLite class DatabaseWrapper { // MARK: -…
CGN
  • 579
  • 4
  • 13