core data : phpmyadmin equivalent - iphone

In my app, I have a pretty huge datamodel and its .sqlite data file.
I would like to parse my records in the .sqlite file, and I'm wondering if there was a tool, like phpMyAdmin.
It would be an xCode tool, for example, or maybe a custom app downloadable on the web.
Does anyone know that kind of tool ?

There are any number of SQLite readers available, but SQLite Manager is popular:
https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/

i like the Core Data Editor, but it is quite expensive (23,99€)
Website:
http://christian-kienle.de/CoreDataEditor
Mac App Store:
http://itunes.apple.com/de/app/core-data-editor/id403025957?mt=12
the cool thing is, that core data editor is even able to generate (good and readable) code

Related

iPhone - creating core data structures on OSX and populate them

OK, I know how to use core data and I know how to populate them from code on Xcode, but how do you guys manage to replicate the same structure on OSX and populate the tables, exporting the final sqlite file to Xcode?
What I mean is this: I want a way to see the same core data structures on OSX and have the ability to populate them with records from comma delimited files, for example, create all the modifications I need and then exporting the sqlite file and the xcdatamodeld file structure to Xcode.
And yes, I know a bunch of apps that enable me to read sqlite files and edit them, but this is not the same thing.
thanks
Sure there is. That is what I have already done. Just make sure you share the same ManagedObjectModel between these two apps. Than you can use your Mac App to populate the database, although I know that CoreData is not a database.
So create a usual CoreData App on the mac or iPhone and make sure you share the same ManagedObjectModel, so copy the file into the app. Then copy the database file from one app to the other and make sure Xcode includes them in the build process.

What's the easiest way to view the contents of an SQL file / app data from an iPhone backup?

I'm looking for an easy way to make sense of a SQL file that I've pulled from some application data in an iPhone backup. It's a huge file with bits and pieces of readable data strewn throughout, and right now I'm reduced to using a text editor to pick through it, which will take years.
Are there any simple SQL viewers available that would work for someone with limited technical knowledge? Or is there a way to export the contents of the file to a more easily readable format?
Really appreciate any help!
Try Base, it is a paid app, but they have a free trial if you download outside of the Mac App Store. I use is daily for sqlite db's
I use SQLiteManager.
There are several other sqlite viewers, like Navicat, but I haven't used them personally.
Alternatively, you can just use sqlite on the command line:
sqlite3 path-to-file
.dump
.quit

Is there a way to populate data via xcode?

I want to input data into a sqlite database so that core data can read from the file but I was wandering if there's a way of populating the sqlite data via xcode or do I have to spend lots of money on an sql manager of some kind like RazorSQL to do it?
I suppose you could do the following:
Create a CoreData-based project that uses the same data-model that you're going to use for your project. To be clear, make it a Mac project and not an iPhone project. Make sure that the project is using an SQLite store, and not something like XML or binary.
In Interface Builder, add a built-in CoreData Entity editor to your view and configure it to hook up with your model (most of this should be automatic!). Then, build and run this application, and you should be able to add as much data as you like. When you are done, simply find out where the persistent store was kept (usually somewhere like ~/Library/Application Support/MyAppName/) and copy that file for later use.
Then, you should be able to use that .sqlite file in any app that is made to work with the same data model. Good luck, and let me know how it goes!

Provide Base Data for Core Data Application?

I'm working on a Core Data app (for iPhone 3.0, though I don't think that really makes a difference here) and it will need to ship with a "starter" database filled with data. With SQLite, I would just have the App copy the populated database from the bundle into the App's documents directory on first launch and then load that database - all the information would come along with it and we'd be ready to go. But with Core Data, I'm not really sure if I can just save the Persistent store to the App bundle and copy it before having Core Data start doing its thing. Will this cause any problems? There is quite a bit of initial data, so I don't want to package it in another format and have to parse through it.
Yes, you can copy over a pre-populated persistent store.
I created a Mac app that populates a store. It is copied into my bundle and at start, copied to the Docs directory. This works fine. I am told the Core Data Books example was developed the same way.
Please note this doesn't mean you can just copy over any old SQLite file. It has to be a Core Data persistent store, though I think you understand that based on your question.
Actually there is a trick: you must name the file you are going to copy over with an extension other than ".sqlite", ".bin" will do. Otherwise Xcode will change the contents of the file when it copies it into the app during the build phase and it won't load.

Add an SQLite database to an iPhone app

I am trying to learn SQLite, and I am building an iPhone app. But I would like to add an SQLite database to my building app. I have got three tutorials, but I am not clear on that code.
How can I add an SQLite database to my building app? What would sample code look like?
First of all you need to create your database.
From the command line create your db file.
sqlite3 mydb.db
Then create the tables within your database
CREATE TABLE tags (id int(5), name varchar(255), created_at datetime, updated_at datetime);
Repeat that for any tables that you want in your database.
Then you need to include the database file in your project. Add the existing database file to your project as you would any other existing file.
Next you will have to link in the framework to interact with the database. This can be found under you current iPhone SDK folder.
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/usr/lib/libsqlite3.0.dylib
Finally you have to include the header file sqlite3.h from
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/usr/include/sqlite3.h
It should now be possible to write code to access your sqlite database from within your iPhone application.
There is lots of information on the web.
Have you looked at the demo application? SQLite Book List This shows examples of common database functions under SQLite. This is effectively using the standard SQLite C APIs.
There are Objective C wrappers which may suite you more.
EntropyDB, SQLitePersistenceObjects and FMDB.
I found this Tutorial and this list of resources which may help.
Recently I've been using an ORM SQLite.net It is the way to go for me but then I'm developing in MonoTouch C#.
Tony
I'd also recommend looking at FMDB. It makes using SQLite slightly more Objective-C/Cocoa-like. It's not a full ORM wrapper or anything though; it just wraps the C API into something a bit more flavoursome.
http://sqlite.org/docs.html is a good place to start.
You might get more useful help if you are more specific about what you are trying to do, and what obstacles you are encountering.
If you use Firefox, there's this handy addon that you can use to manage and create an SQLite database.
you will have to link in the framework to interact with the database. This can be found under you current iPhone SDK folder.
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/usr/lib/libsqlite3.0.dylib
CoreData should help, but I can't find it anywhere in the list of importable Frameworks.
You could take a peek at the iPhone examples, especially the SQLite Book List example.