• 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
Getting NSNumbers (or C scalars) from bytes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting NSNumbers (or C scalars) from bytes


  • Subject: Getting NSNumbers (or C scalars) from bytes
  • From: Christoph Lauterbach <email@hidden>
  • Date: Sun, 11 Mar 2007 15:38:37 +0100

Hi everyone,

I am finding myself in developing a Cocoa framework for accessing MySQL databases. I've tracked the discussions about the necessity of such a thing and know about ODBC and so on, but this project is a self-study. (Gaining/improving knowledge about database and framework concepts.) Anyway, I hope to make it so well that I can provide a public beta (in about ten years).

Well, the framework links to the MySQL C API. Results of a query are provided "as an array of counted byte strings" [MySQL docs], i. e. getting a NSString works like this:

cellContent = [[NSString alloc] initWithBytes: currentCRow[i] length: currentRowLengths[i] encoding: NSASCIIStringEncoding];

My problem: A NSString is okay for character cell, but how can I get a NSNumber (or even C scalars) from a byte array? I could parse a doubles, floats and integers with [cellContent doubleValue] etc. and pass them to NSNumber. But isn't this inefficient?

Thank you for any help or comments
Christoph
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Framework project config & accessing resources in the framework bundle.
  • Next by Date: Re: Framework project config & accessing resources in the framework bundle.
  • Previous by thread: Re: Coredata performance problem : massive insertion produces error in allocate region
  • Next by thread: Ironcoder V
  • Index(es):
    • Date
    • Thread