Teaser: PCTrade sample client for DA/OSX
One of the new features for Data Abstract we’ll be shipping in the May releases is a completely revamped sample infrastructure. I’ll be talking more about this in a future post later this week, but basically, we’ve created one big sample server application, based around a fictional “PC Trade” database that we ship for SQLite, MSSQL and Firebird, that all new client applications talk to.
The idea being that without major setup, you can “just run” the server, and then play around with the client applications.
What i did in the last couple hours (literally) today is create a client application for the iPhone for this. With literally a handful of lines of DA code, “PCTrade for iPhone” can browse available products, client data, and review orders. All data fetching is done asynchronously in the background, making sure the UI always stays responsive.
In a nutshell, the code below does all the magic to – in this example – fetch Products, via DA SQL. The rest of the app is standard Cocoa Touch plumbing.
-(void)viewDidLoad {//... DAAsyncRequest *a =[[rda beginGetDataForSQL:@"SELECT * FROM Products" start:NO]; [a setDelegate:self]; [a start]; } -(void)remoteDataAdapter:(DARemoteDataAdapter *)adapter didReceiveData:(NSData*)data forAsyncRequest:(DAAsyncRequest *)request { DABin2DataStreamer *bin2 =[DABin2DataStreamer dataStreamerWithData:data]; [table release]; table =[[bin2 getDataTable:@"sql"] retain]; [[self tableView] reloadData]; } |