• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: SMySQL Problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SMySQL Problems


  • Subject: Re: SMySQL Problems
  • From: Chris Hanson <email@hidden>
  • Date: Thu, 10 Oct 2002 01:15:43 -0500

At 12:48 PM +1000 10/10/02, Syphor wrote:
The Result I get is:

[code]
Result - <54657374 >
[/code]

It looks like you may have an invisible primary key column in your database, or that the value of the object for the key you're requesting in the dictioonary isn't of the type you think it is.

Incidentally, you're doing more work than necessary in your code. You're instantiating a dictionary and an array, and then just throwing them away. It seems as though you think you need to "initialize a variable" before you can assign something to it, or something like that. You don't need to; what you're doing is just creating extra temporary objects that are never used.

-- Chris

PS - For the curious, here's what this code would look like if the Enterprise Objects Framework was still around for Cocoa:

- (void)getResult
{
// Assume EOF has already connected to the database as described
// in your EOModel, and that we have an editing context. Also
// assume that the "TestTable" table is mapped to an entity named
// "TestEntity" and a class named "TestClass".

EOEditingContext *editingContext = [self editingContext];
NSArray *results = [editingContext objectsForEntityNamed:@"TestEntity"];
TestClass *test = [results objectAtIndex:0];

NSLog(@"Result - %@", [test testText]); // should log "Test"
}

Note what I didn't have to do: Write any SQL. Also note that EOF translated rows in the "TestTable" table to instances of TestClass transparently, I didn't have to deal with result sets at all. These instances live in an "editing context," which manages an object graph that's backed by a database (or other data store). Editing contexts also track changes to the objects they manage, so features like undo are easy to implement.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: SMySQL Problems
      • From: Finlay Dobbie <email@hidden>
References: 
 >SMySQL Problems (From: Syphor <email@hidden>)

  • Prev by Date: Re: Cocoa newbie query
  • Next by Date: Re: Carbon vs Cocoa arguments
  • Previous by thread: SMySQL Problems
  • Next by thread: Re: SMySQL Problems
  • Index(es):
    • Date
    • Thread