Re: [Mysql-cocoa-users] MySQL Result in NSTable
Brought to you by:
sergecohen
From: John G. <jo...@jl...> - 2003-03-10 21:39:01
|
Rob, I've been using Cocoa now for about a year now, and I've been using Serge's Framework since it came out. a couple of points to help get you going: 1) As has already been mentioned, if you want to get to grips with Cocoa as painlessly as possible, get hold of Aaron Hillegass's excellent book "Cocoa programming for Mac OS X" it will save you a lot of heart ache, and has excellent examples. 2) You can also subscribe to the cocoa-dev list over at Apple's developer site, but it is a high volume mailing list. BUT the mailing list is archived at http://cocoa.mamasam.com/ and here you can find answers to nearly everything you need. OK to get cocoa working with the mysql framework and your table views you need to actually achieve two different things: 1) Get connected to the database, issue a query, and get the results back. This is actually really straight forward, and the best place to start is to have a look at the documentation that comes with the Framework and the test application. Basically you need to establish a data base connection (using one of the framework classes) and then you send your query to the new object and it will return you a result set you can enumerate through. 2) Next you will need to cache the data you retrieved within your cocoa application so you can feed the NSTableView when it asks for things (you will need to write the delegate methods for the NSTableView). NOTE I am recommending you cache the query results otherwise you will incur a huge overhead hitting the DB everytime the user does something that causes OSX to redraw the table view. If you think in terms of Model View Controller, you manage you Model as a combination of the local cache and the database, the view contains your NSTableView, and the controller manages the delegate methods etc. that feed the table view from the Model. I hope this gives you some pointers to get you going. I am still using a fairly old version of the Framework (as I haven't had time to update my application to use the new object names and method calls that Serge introduced a while ago), however at some point in the near future I am sure I could whip up a simple test program for you ALTHOUGH I think you would find it better to just get it going yourself from the examples ;) all the best JOhn On Friday, March 7, 2003, at 11:09 PM, Rob P. wrote: > Someone please help... > > I'm new to Cocoa, and really need help learning on how to get a result > from a MySQL query, and putting the result into multiple fields on an > NSTableView. Any help would be greatly appreciated, thanks. > > Rob P. > > |