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

Correct variable binding and avoiding SQL injection with SQLite.swift queries

The SQLite.swift documentation for filtered queries gives this example: users.filter(email.like("%@mac.com")) // SELECT * FROM "users" WHERE ("email" LIKE '%@mac.com') Since I want to search the database based on user input, I guess I could do the…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
2
votes
2 answers

Reading the name of Table()

How can I read the table's name after having created one width Table(name)? Example: let tab = Table("myTable") let name = ?? Actually, this example does not make sense, but im my use case the variable "tab" is a class property and the class does…
Bernd
  • 169
  • 2
  • 9
2
votes
0 answers

Swift Database Class using SQLite.swift

I am trying to create a class to handle all the database interaction based on SQLite.swift and keep running into errors because the initialization of the the connection (and other related objects) happens in a try catch. Here is a simplified example…
Frank Conry
  • 2,694
  • 3
  • 29
  • 35
2
votes
0 answers

JOIN with SQLite.swift

I'm trying to run a fairly complex SQL JOIN using SQLite.swift, and have the results put into an array. Assigning the results of a select to an array works without a problem but I'm not sure if this is the correct or best method for executing such a…
empedocle
  • 1,862
  • 1
  • 14
  • 25
2
votes
2 answers

Why do I get Unable to Open Database file?

I am a beginner in iOS development and I want to develop a database in my application. However, When I try to create the database it says unable to open database file. For clarification…
user5246938
2
votes
2 answers

iOS: dyld: Library not loaded with SQLite

I'm using SQLite for the extension in an app. Everything work fine in Simulator, but error has occurred when i run the app in my device. dyld: Library not loaded: @rpath/SQLite.framework/SQLite Referenced from:…
TomSawyer
  • 3,711
  • 6
  • 44
  • 79
2
votes
3 answers

SQLite Swift db.prepare Optional() in statement values

In the SQLite Swift documentation there is reference to getting statement results directly. I have a lot of SQL queries prepared and I don't really want to refactor them. I would sooner use them as they are using db.prepare, as per…
Mark80
  • 55
  • 1
  • 7
2
votes
0 answers

SQLite.swift swift 2 - select all columns of a table with * from in joined tables

I am trying to select all columns from a table in a joined SQLite.swift table statement with the help of the select function, but I always get the following error: Cannot invoke 'select' with an argument list of type '(Expression)' Here is a…
maddob
  • 989
  • 1
  • 12
  • 29
2
votes
2 answers

How to delete table or update column with SQLite.swift ?

I need to re-create my table in my database. Is there anyway to update table's columns or delete table with SQLite.swift ?
letitbefornow
  • 427
  • 6
  • 20
2
votes
3 answers

Why saving data to SQLite database doesn't work with Swift 2?

I'm using SQLite.swift and I'm using these code from demo of SQLite.swift. import UIKit import SQLite class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let db = try! Connection() …
David
  • 1,660
  • 3
  • 21
  • 33
2
votes
1 answer

How to Delete Rows with SQLite.SWIFT?

I use SQLite.SWIFT and want to delete rows with specific id from my table. The documentation here said that I can use: let delete = delete.update(email <- "alice@me.com") if let changes = delete.changes where changes > 0 { println("deleted…
Michael
  • 32,527
  • 49
  • 210
  • 370
2
votes
1 answer

SQLite.swift performing a left join and using the data

I am trying to perform a left join SELECT TProgram.ProgramName, TProgram.ProgramPath From TProgram LEFT JOIN TIcons ON TIcons.ProgramName = TProgram.ProgramName WHERE TIcons.ProgramName IS NULL GROUP BY TProgram.ProgramName with swift. So i did the…
Silve2611
  • 2,198
  • 2
  • 34
  • 55
2
votes
1 answer

Sqlite.swift create dynamic complex queries

I have 1 table with multiple columns. On the app, we are looking forward to add 4 dynamic filters like (cat, size, color,shape). We know we can create a filter to sqllite like so: user = user.select(name) .filter((color == "Blue") && (size…
danielsalare
  • 335
  • 3
  • 14
2
votes
1 answer

Trying to insert 10000 records sqlite ios swift

I am trying to insert 10000 records and its taking 45 secs this is my code println(NSDate.new()) for index in 0...10000{ countrys.insert(name <- "abc") //println(index) } println(NSDate.new()) is this way to do it?
vinbhai4u
  • 1,329
  • 3
  • 19
  • 36
2
votes
1 answer

Cannot invoke 'insert' with an argument list of type

The code to insert records into a table was working fine before the latest update, but now is throwing up this error so I was wondering what I was doing wrong. Example code for record insert: Recipes.insert(Title <- "Chocolate Cake", Description…