Re: Binary primary keys
Re: Binary primary keys
- Subject: Re: Binary primary keys
- From: Lachlan Deck <email@hidden>
- Date: Fri, 27 Nov 2009 04:26:55 +1100
Yeah, don't rely on *.toString() which is often just a convenience for debugging purposes (sometimes sadly).
try:
String hexString = new String(nsdata.bytes(), "UTF-8");
On 27/11/2009, at 1:14 AM, Jeff Dunnett wrote:
> Oh yeah...
>
> <class com.webobjects.foundation.NSData (offset=0, length=24, data=[0]'', [0]'', [-127]'?', [97]'a', [-116]'?', [-75]'?', [0]'', [0]'', [7]'', [-46]'?', [4]'', [0]'', [0]'', [0]'', [1]'', [31]'', [-123]'?', [-28]'?', [113]'q', [84]'T', [10]'
> ', [43]'+', [47]'/', [67]'C')>
>
> Regards,
> Jeff
>
>
> On 26-Nov-09, at 8:39 AM, Mike Schrag wrote:
>
>> ... and instead it's .....
>>
>> On Nov 26, 2009, at 8:37 AM, Jeff Dunnett wrote:
>>
>>> Hi Chuck,
>>>
>>> Ops I knew I forgot to mention something. It is supposed to be in Hex looking like 0x000081618cb5000007d302000000011696cb1cdd430dea9f.
>>>
>>> Regards,
>>> Jeff
>>>
>>> On 25-Nov-09, at 5:25 PM, Chuck Hill wrote:
>>>
>>>> What does it look like? What is it supposed to look like?
>>>>
>>>>
>>>> Chuck
>>>>
>>>>
>>>> On Nov 25, 2009, at 1:27 PM, Jeff Dunnett wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> All of the Entities in our model use primary keys that have an external data type of binary with a width of 24. I have to use some raw SQL to write some queries...One of those raw SQL queries fetches the primary key of a row. I then need to use that primary key to form the basis of another raw SQL query. I save that primary key into a NSData object. The problem is I can't seem to convert that object into a format that is can be used in another query. When I try to print the information out it doesn't look right to the eye. Anyone have anything idea's on how I might do this?
>>>>>
>>>>> i.e
>>>>>
>>>>> String sqlString = "SELECT contest_id FROM \"cms\".\"ms_contest\" WHERE contest_event = '" + contest.contestEvent() +"'";
>>>>>
>>>>> NSArray result = EOUtilities.rawRowsForSQL(ec, "cms", sqlString);
>>>>>
>>>>> NSDictionary dict = (NSDictionary)result.objectAtIndex(0);
>>>>>
>>>>> NSData data = (NSData)dict.objectForKey("CONTEST_ID");
>>>>>
>>>>> logger.debug("Contest ID: " + data);
>>>>>
>>>>>
>>>>> Regardds,
>>>>> Jeff
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Webobjects-dev mailing list (email@hidden)
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>
>>>>> This email sent to email@hidden
>>>>
>>>> --
>>>> Chuck Hill Senior Consultant / VP Development
>>>>
>>>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>>>> http://www.global-village.net/products/practical_webobjects
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
with regards,
--
Lachlan Deck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden