Getting NSNumbers (or C scalars) from bytes
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