简体   繁体   English

什么是收集iPhone sqlite db数据的最佳方法

[英]What is the best way to collect data for iphone sqlite db

I want to build an iphone app with data pre-filled sqlite db. 我想用数据预填充的sqlite db构建一个iphone应用程序。 But how to fill data in the beginning comes to be a small problem. 但是,如何从一开始就填充数据将成为一个小问题。

My partner and I may both need to access the db and edit data. 我和我的伴侣都可能需要访问数据库并编辑数据。

I thought to build a web interface to edit the data, but my host service only provide PHP+MYSQL solution for me, then if I put the data in MYSQL, how to extract it all into a sqlite db? 我曾想过要构建一个Web界面来编辑数据,但是我的主机服务仅为我提供PHP + MYSQL解决方案,那么如果我将数据放入MYSQL中,如何将其全部提取到sqlite数据库中?

Any good suggestion for my question? 对我的问题有什么好的建议吗? is there any solution for sqlite db remote editing and we can download that sqllite db in the end? sqlite db远程编辑有什么解决方案,我们可以最后下载该sqllite db吗?

i got solution of searching and i done it this is a code to save sqlite data string save in to txt file at application documents directory 我得到了搜索解决方案,我做到了,这是一个将sqlite数据字符串保存到应用程序文档目录中的txt文件中的代码

-(IBAction)creatTxt{
appDelegate = (evernoteAppDelegate *)[[UIApplication sharedApplication] delegate];
NSString *str;

for (int i=0; i<[appDelegate.noteArray count]; i++) {

    nottxtobj = [appDelegate.noteArray objectAtIndex:i];
    str=[NSString stringWithFormat:@"Title=%@\nDiscription=%@",nottxtobj.noteTitle,nottxtobj.noteDisc];
    NSLog(@"data=%@",str);


    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *docDir = [paths objectAtIndex:0];

    NSString *filename = [docDir stringByAppendingPathComponent:[NSString stringWithFormat:@" %d.txt",nottxtobj.noteID]];
    NSError *error = NULL;
    BOOL written = [str writeToFile:filename atomically:YES encoding:NSUTF8StringEncoding error:&error];
    if (!written)
        NSLog(@"write failed, error=%@", error);
    }



}

i hope This code is useful for you thank you 我希望这段代码对您有用,谢谢

I don't know about concurrent editing of a SQLite database, but one option you have is to create your database in MySQL then export it as a sql file which you then import into SQLite when you are satisfied with the contents. 我不知道如何同时编辑SQLite数据库,但是您可以选择的一种方法是在MySQL中创建数据库,然后将其导出为sql文件,然后在对内容满意后再导入到SQLite中。

There is one obvious problem with this though, the syntax of the two databases differs slightly. 但是,这有一个明显的问题,两个数据库的语法略有不同。 As long as you aren't using advanced features of MySQL, the majority of the SQL you export from MySQL, using something like the command line tool mysqldump or the export feature in PHPMyAdmin, should work in SQLite. 只要您不使用MySQL的高级功能,使用命令行工具mysqldump或PHPMyAdmin中的导出功能之类的东西,从MySQL导出的大多数SQL都应在SQLite中工作。

You would need to prune out the additional data inserted by MySQL for MySQL. 您将需要修剪MySQL为MySQL插入的其他数据。 Luckily people have wanted to do this before and a quick google search brings up a bunch of promising results. 幸运的是,人们以前曾经想这样做,而谷歌快速搜索带来了很多有希望的结果。

The SQLite site has some options too: http://www.sqlite.org/cvstrac/wiki?p=ConverterTools SQLite网站也有一些选项: http ://www.sqlite.org/cvstrac/wiki?p=ConverterTools

There a bunch of links for software you have to buy, but there is a free shell script about half way down that looks like it might work. 有很多必须购买的软件链接,但是有一个免费的shell脚本,它看起来差不多可以工作了一半。

A free and easy solution: Open a Google Spreadsheet, work on it both, each time you need the result to be inputted into the core data DB just save it as .txt or a .csv and import into the DB. 一个免费,简单的解决方案:每次需要将结果输入到核心数据数据库中时,打开Goog​​le Spreadsheet对其进行处理,只需将其另存为.txt或.csv并导入数据库即可。
A plugin for Firefox that you may find useful for the last part: SQLite Manager. Firefox插件,您可能会在最后一部分发现有用:SQLite Manager。
Good luck. 祝好运。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将包含对象的PHP数组存储到像SQLite这样的数据库中的最佳方法是什么? - What is the best way to store, a PHP array with objects in it, into a DB like SQLite? PHP脚本安装:安装sqlite.db文件的最佳方法是什么 - Php script installation: what is best way to install sqlite.db file 测试sqlite表中是否存在值的最佳方法是什么? - What's the best way to test if a value exists in an sqlite table? 将更新从服务器发送到iPhone的最佳方法是什么? - What will be the best way to send update from server to iphone? 关于从互联网爬网/爬网/收集音频内容的最佳方法的建议/技巧 - Advice/Tips on what the best way to spider/crawl/collect audio content from the internet 在PHP / MySQL DB中存储和检索数组的最佳方法是什么 - What is the best way to store and retrieve an array in PHP/MySQL DB 使用 DB:raw 在 laravel 中处理此子查询的最佳方法是什么? - What is the best way to handle this sub query in laravel using DB:raw? 在命名数据库中引用和调用信息的最佳方法是什么 - What is the best way to reference and call info in a naming db 用AJAX更新DOM以反映数据库中的更改的最佳方法是什么? - What is the best way to update the DOM with AJAX to reflect changes in the DB? 在页面上收集用户数据,在保留页面其余部分的同时在同一页面上显示的最佳方法 - Best way to collect user data on a page, display it on the same page while preserving rest of the page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM