groue / GRDB.swift

A toolkit for SQLite databases, with a focus on application development
MIT License
6.88k stars 708 forks source link

Problem in batch insert records #532

Closed MrShafiee closed 5 years ago

MrShafiee commented 5 years ago

Hi @groue , Thanks for your great library, I have a problem in batch insert records while I make my queries in loop. I use Xcode 10.2 and swift 5.0 .

You can see my code in below image: image of my code

when I want pass studentsQueriesParams to db.execute() I get this error:

Cannot convert value of type 'StatementArguments' to expected argument type 'StatementArguments?'

I searched the document and issues, and all of them were the same as me, what should I do? Thanks

groue commented 5 years ago

Hello @MrShafiee,

This is very weird, but more a problem somewhere in the Swift code or compiler than a problem with GRDB. I'm sure you'll figure it out. Try to create an intermediate StatementArguments variable, it should help.

MrShafiee commented 5 years ago

Hi @groue , Thanks for your response, I check all parameters about GRDB library, swift version, Xcode compiler and finally found it's about GRDBCipher !! when I use it and import GRDBCipher instead of GRDB I got above Swift Compiler Error and if I change it to GRDB everything is okey!

But I need encrypt my DataBase file, what is your suggestion? Do you have any experience about this issue?

Thanks.

MrShafiee commented 5 years ago

Oops,I found the problem! In my database config file I import GRDBCipher but in queries controller I import GRDB , therefore I got that compiler error. I changed both of the to import GRDBCipher and everything work perfectly. I share it here maybe help other persons.

Thanks

groue commented 5 years ago

Yes you caught it! You don't need to build GRDB either. GRDBCipher is a standalone library that does not need support from the core GRDB.