如何将sql数据导入sqlite?

I have an iPad application that suppose to be able to work offline. I got a local database(sqlite) that stored all the data needed. When i want to update the database, i create my query from the server side (PHP server), make it as a sql file, download to the app, and tried to read the sql file. Below is the sample code

$txt = "CREATE TABLE IF NOT EXISTS `UOM` (`uom_id` int(11), `uom_name` varchar(200), `uom_status` int(11));";

$txt .= "INSERT INTO `UOM` (`uom_id`, `uom_name`, `uom_status`) VALUES (1, 'Unit', 1);";
$txt .= "INSERT INTO `UOM` (`uom_id`, `uom_name`, `uom_status`) VALUES (2, 'Kg', 1);";
$txt .= "INSERT INTO `UOM` (`uom_id`, `uom_name`, `uom_status`) VALUES (3, 'Liter', 1);";

$myfile = fopen("queries_" . $timeStamp . ".sql", "w");
fwrite($myfile, $txt);
fclose($myfile);

My question is, how can i import it into my local database ?i cannot open the sql file and read the query line by line since the file is too large(my database contain more than 40k of records), when I try to read it line by line (inside a loop) the app crash due to memory problem (very tight loop). I would like to know is there any way to execute this sql file on my local database without reading the file ?something like import this sql file to my local database programatically.

Thanks.

Well what you need is a service to return you subset of data like paging. And then load one by one each pages. Its lengthier process but its more memory efficient.

I think the best way is create synch your db with remote db using get or post request that producing JSON format.

For example : GET
http://your....website.com/request/updateData.php?page=1&lastUpdate=342349218312312

Where you passing the page number and the timestamp for your local db.

Your Json response with number of page and you custom data.