views:

59

answers:

1

Hey guys,

i was searching SO for help on this, but i can't seem to find a concrete solution. Is, or isn't it possible to connect to a mysql database with Cocoa? Because i'm working on a program that i'd like to extend to a database, but i sure as hell don't know how! I mean, that cocoa-mysql package is heavily outdated, and i dont even know what a C wrapper is!

Can someone please tell me how to do this, or atleast burst my bubble to tell me that it can't be done?

Thanks!

A: 

Since Core Data came out, I'm not surprised that other DB-wrapping Cocoa libraries are falling out of date. If you don't need to specifically wrap a MySQL DB, then I'd look at Core Data and its SQLite backend. It's available for both Mac OS and iPhone platforms.

Shaggy Frog
Well, it's not that i don't need to wrap, i just don't know what wrapping a c mysql api means :PAnd, i do need MySQL and not SQLite, and i was looking at the apple docs about that Core Data, it's not really meant for MySQL right?thanks for the quick comment btw :)
BryCry
Wrapping means to take an existing interface and expose it to the world using another interface. An example would be to take the existing MySQL C API and creating a Cocoa layer around it that clients use instead -- where the layer handles all the C-specific steps required to access MySQL, so your client never needs to know the C API exists.
Shaggy Frog
Ok, but how do i 'wrap' such apis?
BryCry
See my answer here: http://stackoverflow.com/questions/1319916/tips-on-wrapping-a-c-library-in-objective-c/1319934#1319934
Shaggy Frog
BryCry: Write a library providing a Cocoa interface (probably consisting of classes) to manipulate a database. In the implementation of that library (those classes), call functions of the MySQL C API.
Peter Hosey