See responses inserted below.

Vince

On Mon, Nov 16, 2009 at 4:13 PM, Rainer <[email protected]> wrote:

>
> Good point Baz:
> At the moment I use GoogleWrite(MyObj,getMetaData
> (MyObj).name,'MyKey123'). Why must I give the name of my object as an
> argument, when the function GoogleWrite should be able to fetch it
> itselve from the first argument MyObj?
>

A "kind" can be whatever you want it to be; it's completely arbitrary and is
used only to group CFC types for querying, which is done based on "kind".


>
> I furthermore must recall my latest blog here: keyName NOT EQUALS
> googleKey!!! I still think that the implementation of the unique keys
> of objects in the datastore is confusing!
>
> First of all, you can NOT use the 'GoogleKey' which is generated by
> the function 'GoogleWrite'. If you try 'GoogleKey = GoogleWrite
> (myObj,myKind)' and in a next request you use the GoogleKey to do an
> update like 'GoogleKey2 = GoogleWrite(myObj,myKind,GoogleKey)', there
> will be 2 objects in the datastore, and 'GoogleKey2' NOT equals
> 'GoogleKey'!
>

Correct. A "Google Key" consists of three parts: (1) a parent key (which
we're currently not using in OpenBD); (2) a "kind"; and, (3) either a
keyName or a keyID. If you allow OpenBD to generate a GoogleKey, it uses the
CFC type as the "kind" and let's the datastore automatically generate a
unique value for the keyID. If you specify the "kind" and keyName yourself,
OpenBD uses these to create the GoogleKey. In the latter case the keyName is
only one component of the GoogleKey and not equivalent to the entire key.


>
> Secondly, if you generate a unique key yourselve (f.i. myUniqueKey =
> CreateUUID()), you must store this unique key as a property in your
> object in order to be able to update this object in the datastore. Let
> me explain: I save a new object to the datastore with 'GoogleWrite
> (myObj,myKind,myUniqueKey)'. In a next request, I must read
> myUniqueKey from a (listed) object, in order to be able to update the
> object in the datastore by doing a 'GoogleWrite
> (myObj,myKind,myUniqueKey)'. I think that's really stupid, if there's
> already a GoogleKey!
>

When you read an object from the datastore the GoogleKey is automatically
embedded within the object. You can display this value via <cfdump
var="#googleKey(myObj)#">. Because the object already has a key associated
with it, you don't need to specify it in a subsequent call to GoogleWrite()
to update the object; just do this: GoogleWrite(myObj).


>
> And now I am back at my first point, that you can NOT use the
> GoogleKey!
>
> So, what I am trying to say is that the idea of having a GoogleKey is
> really great, because you would not have to store a unique key in your
> object. But that only works if you can first do a GoogleKey =
> GoogleWrite(myObj) and than later on use this GoogleKey to do a
> GoogleWrite(myObj,GoogleKey), and NOT GoogleWrite(myObj,keyName)!!
>

The unique key is stored for you automatically when you read the object from
the datastore.


>
> Vince, could you please respond to this post and let me know what you
> think, I would really appreciate that.
>
> Cheers,
>
> Rainer.
>
>

-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 mailing list - http://groups.google.com/group/openbd?hl=en

 !! save a network - please trim replies before posting !!

Reply via email to