I created a database(empty) with in terminal from the /usr/bin directory using:
touch /Users/myusername/Desktop/testopeningbook4.db
It showed on the desktop. Then imported it into my Xcode OSX project(Mac app i made to do databasing) with add files and selected the option copy files into the project and testopeningbook4.db shows in my project files in xcode(in project navigator) and is in my project folder for the app(in finder). It's no longer on the desktop I think I deleted that copy.
I opened the database in an objective-c code file/class and I've stored a few hundred thousand entries into it now, I believe(confirmed there is a lot of stuff in it now when I query with select but I havent counted and I am only running my app to test this from xcode as the results of select lack a gui now and go to the console with nslog).
See what I wanted to do was see how big the file got. But the one in the xcode project folder says its 0 bytes. I open it like this:
NSString *dbPath = [[[NSBundle mainBundle] bundlePath]stringByAppendingPathComponent:@"testopeningbook4.db"];
sqlite3 *database;
if(!(sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK))
{
NSLog(@"An error has occurred did not open database.");
return false;
}
else
{
NSLog(@"opened database");
}
Ideally what I want to do is copy the testopeningbook4.db file and import it into another xcode project for iOS this time for an iPhone/iPad app. But since the file in the xcode project folder is 0 bytes that must not be the right thing to copy. I found two links and tried both these ideas(i've closed the pages since and don't have the links):
one said drag the database from the Xcode project navigator and you could drag it out a copy onto the desktop. I did that. It's like 440 kilobytes which seems to small since testopeningbook3(now deleted) was about that size and I used a much smaller source file for it's data, but bigger than 0 kilobytes in the xcode project. I went to /usr/bin and typed
sqlite3 /databasepathtodesktop/testopeningbook4.db
Next in the sqlite3 command prompt typed
.tables
and it didn't list anthing leading me to think its empty and not the copy that is working in my program.
The second idea I found from a link was to archive the project then get your database out of the archive. So I made a .xcarchive file and right click and do show package contents. In the contents I get to my app and again right click and do show package contents, then I get to the resources folder and my database is in there but again it's 0 byteslike the one in my project directory.
How would I get back the testopeningbook4.db with the data and megabytes all apart of it to import into another project or move it between computers.
I'm using Xcode 5.1.1 Thanks Mike
Edit: Modified the title to be more descriptive of the actual problem