Querying a database using Cocoa.

Posted by S1syphus on Stack Overflow See other posts from Stack Overflow or by S1syphus
Published on 2010-05-10T14:29:30Z Indexed on 2010/05/10 15:14 UTC
Read the original article Hit count: 273

Filed under:
|
|
|

Hello everybody.

Before I start a disclaimer, I should add a little disclaimer, that I am relatively new to Cocoa development and C in general.

However I do have a copy of 'Cocoa Programming for Mac OS X 3rd edition' by Aaron Hillegass, which I am working through and using as a base, if anybody has a copy I am using the 'AmaZone' example on page 346 as a template and base.


I trying to develop a small client app that takes a search string then displays results from a database accordingly.

The database will contain a: list of files, their location, description & creation date, so for the moment the field number and types will remain the same.


After looking around on SO, I saw something like:

NSURL *myURL = [NSURL URLWithString:@"http://www.myserver.com/results.php"];
NSArray *sqlResults = [[NSArray alloc] initWithContentsOfURL:myURL];

I've worked with php before, so my current thinking after seeing this is create a php script on the server that queries the database, and creates an XML output.

And with the XML response, just parse it.

Would this be ok? as is there any major pitfalls anybody can see, that I can't.

I know there are some database bundles, I've had a look at BaseTen for Postgres, but being relatively new to this, didn't want to get in over my head.

Or if anybody else has any other suggestions and ideas, they would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about database