Re: [Mysql-cocoa-users] Getting out the starting gate
Brought to you by:
sergecohen
From: John G. <jo...@jl...> - 2003-11-10 09:45:45
|
Just a quick reply for you, it doesn't really matter where you are trying to extract data from the=20= database, awakeFromNib, init or even you own custom methods, the=20 process is basically the same: The framework contains two primary classes that work together MCPConnection which establishes and maintains the connection to the=20 database (you issue SQL queries to an open MCPConnection) and MCPResult which manages access to a result set from a query issued=20= to the MCPConnection. The process typically follows the following logic 1) Establish a connection to a mySQL database (it can be local or=20 remote) eg. MCPConnection *theConnec =3D [MCPConnection alloc]; theConnec =3D [theConnec initToHost::albert.com withLogin:@"toto"=20 password:@"albert" port:0]; [theConnec selectDB:@"db1"]; 2) execute a query which will return a MCPResult object theRes =3D [theConnec queryString:@"select * from table1"]; 3) finally process each line returned in the result while (theDict =3D [theRes fetchRowAsDictionary]) { // do something } 4) finally release all your objects which will free all the cached=20 values etc. Look in the documentation that comes with the framework for=20 MCPConnection and MCPResuly, these contain example code snippets that=20 contain everything you need to get going if you are familiar with SQL=20 (that is where I got the code snippets from above) hope this helps JOhn =A0=A0=A0=A0 On Sunday, November 9, 2003, at 07:16 PM, chris wrote: > I'm trying to get even the most basic returns from MySQL and having=20 > difficulty getting results. How would I say at awakeFromNib to put=20 > into my text field the contents of a table? > > --chris > > > > ------------------------------------------------------- > This SF.Net email sponsored by: ApacheCon 2003, > 16-19 November in Las Vegas. Learn firsthand the latest > developments in Apache, PHP, Perl, XML, Java, MySQL, > WebDAV, and more! http://www.apachecon.com/ > _______________________________________________ > Mysql-cocoa-users mailing list > Mys...@li... > https://lists.sourceforge.net/lists/listinfo/mysql-cocoa-users > |