Executing queries from sqlite file in iOS

421 views Asked by At

Is it possible to read a .sqlite script with row insertions and updates in iOS? Or if you want to read sql statements from a file, you can only read the file line by line as if it were a regular text file? I need to make a large amount of row insertions in an already existing sqlite table I have, and I have all the insert statements in an .sql file. I've looking for a way to do this, but I was not able to find any for iOS.

Thanks!

1

There are 1 answers

2
Wain On

Your .sqlite script is just a text file so you can load it. You can read it in line by line but you can also read the whole script (depending on size) into an NSString (stringWithContentsOfFile:encoding:error:) and then use the contents however you want.