Rainer,

What do you get for GoogleKey when you do 'GoogleKey =
GoogleWrite (myObj,myKind)'?

Baz


On Mon, Nov 16, 2009 at 1: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?
>
> 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'!
>
> 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!
>
> 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)!!
>
> Vince, could you please respond to this post and let me know what you
> think, I would really appreciate that.
>
> Cheers,
>
> Rainer.
>
>
>
>
> On Nov 16, 8:55 pm, Bassil Karam <[email protected]> wrote:
> > My pleasure :)
> >
> > One suggestion I would make to Vince is to reverse the positions of the
> > attributes "kind" and "keyName" and to not make "kind" required if
> "keyName"
> > is specified. For example, if I wanted to save an object, I could do:
> >
> > googleWrite(MyObj);
> >
> > This will automatically populate the kind and the keyName, but if I had
> my
> > own key name, it seems I should be able to simply provide it:
> >
> > googleWrite(MyObj, 'MyKeyName');
> >
> > With the "kind" automatically populated as before. Why should I have to
> now
> > specify it just because I have a key?
> >
> > Similarly if you invoke googleWrite on the component itself:
> >
> > MyObj.googleWrite('MyKeyName')
> >
> > I think keyname is going to be specified MUCH more often than kind and
> > should therefore precede kind in the attribute list and also not be tied
> to
> > it.
> >
> > Just some thoughts,
> > Baz
> >
> > On Mon, Nov 16, 2009 at 11:17 AM, Rainer <[email protected]>
> wrote:
> >
> > > Thanks Baz, that one helped me out.
> >
> > > I didn't get it into my grey cells that keyName = googleKey. Of
> > > course, it's not a problem to use a kind, but I didn't know that you
> > > can use a GoogleKey as a KeyName to update an object with GoogleWrite.
> >
> > > Great, let's put my model together this night!
> >
> > > Thanks again Baz.
> >
> > > Rainer.
> >
> > > On Nov 16, 6:25 pm, Bassil Karam <[email protected]> wrote:
> > > > Rainer,
> >
> > > > For your first question you say that you have the google key in a
> hidden
> > > > form field. So that means you can do:
> >
> > > > googleWrite(MyCFC, 'MyKind', 'MyKey123');
> >
> > > > What's the trouble? Is it that you would prefer to do something like:
> >
> > > > MyCFC.setGoogleKey('MyKey123');
> > > > MyCFC.googleWrite();
> >
> > > > So that you don't have to specify a kind?
> >
> > > > Baz
> >
> > > > On Mon, Nov 16, 2009 at 1:27 AM, Rainer <[email protected]>
> > > wrote:
> >
> > > > > Sorry for my mistake...
> > > > > In my option 2) I know, that I can update an object with
> GoogleWrite
> > > > > (kind,keyName), so that's not my question there.
> > > > > My question in option 2) is:
> > > > > How do I get the kind and Keyname when I do a listing?
> > > > > - aUsers = GoogleQuery('select from User');
> > > > > - loop over aUsers
> > > > > - have an User object, can I do than a User.getKind() and
> > > > > User.getKeyName()?
> >
> > > > > Rainer.
> >
> > > > > On 16 nov, 10:18, Rainer <[email protected]> wrote:
> > > > > > Vince,
> >
> > > > > > Coul you please clarify me on this subject, I don't get 'the
> circle
> > > > > > closed'.
> >
> > > > > > When I follow the documentation athttp://
> > > > > wiki.openbluedragon.org/wiki/index.php/GoogleAppEngine:Datastore,
> > > > > > I can't seem to make a closing structure of my logic.
> >
> > > > > > 1) When I choose to go for the googleKey (which I higly prefer,
> > > > > > because it's generated by the datastore), I do the following:
> > > > > > - create an object from my User.cfc (bean); User = CreateObject
> > > > > > ('component','model.user.User').init()
> > > > > > - write it to the datastore; googleKey = GoogleWrite(User);
> > > > > > - read from the datastore; User = googleRead(googleKey);
> > > > > > - get list of users; aUsers = GoogleQuery('select from User')
> > > > > > But what if I have a the details of a user in a form (with the
> > > > > > googleKey in a hidden input), and I post this form.
> > > > > > How do I than create a User object that 'knows' the googleKey so
> that
> > > > > > a GoogleWrite() will update an exisiting object in the datastore?
> > > > > > Should I first do a 'User = googleRead(googleKey)' and than
> update
> > > the
> > > > > > properties with my form properties, and than 'GoogleWrite(User)'?
> > > > > > Or can I set the googleKey in my User object with a
> 'setGoogleKey()'
> > > > > > function, or something like that?
> >
> > > > > > 2) When I choose to go for the combination kind/keyName, I do the
> > > > > > following:
> > > > > > - create an object from my User.cfc (bean); User = CreateObject
> > > > > > ('component','model.user.User').init(kind,keyName)
> > > > > > - write it to the datastore; GoogleWrite(User,kind,keyName);
> > > > > > - read from the datastore; User = googleRead(kind,keyName);
> > > > > > - get list of users; aUsers = GoogleQuery('select from User');
> > > > > > But what if I have a the details of a user in a form (with the
> kind
> > > > > > and keyName in a hidden input), and I post this form.
> > > > > > How do I than create a User object that 'knows' the the kind and
> > > > > > keyName so that a GoogleWrite() will update an exisiting object
> in
> > > the
> > > > > > datastore? Should I first do a 'User = googleRead(kind,keyName)'
> and
> > > > > > than update the properties with my form properties, and than
> > > > > > 'GoogleWrite(User)'?
> > > > > > Or can I set the kind and keyName in my User object with
> > > 'setGoogleKind
> > > > > > () and setGoogleKeyName()' functions, or something like that?
> >
> > > > > > Maybe, I am overseeing something very badly, but after read the
> doc a
> > > > > > couple of time, and trying some different code, I coul not come
> up
> > > > > > with a solution.
> >
> > > > > > Thank you in advance for helping me out,
> >
> > > > > > Rainer.
> >
> > > > > > On 14 nov, 10:52, Rainer <[email protected]> wrote:
> >
> > > > > > > Great! ... but, how do I know when I try to insert a new object
> > > what
> > > > > > > the new int (max int + 1) is for this specific object's
> keyName?
> >
> > > > > > > And if I start using a UUID, is it unique enough to be sure it
> was
> > > not
> > > > > > > used before in a save action to the datastore?
> >
> > > > > > > Questions... questions...
> >
> > > > > > > Rainer.
> >
> > > > > > > On Nov 14, 2:01 am, Bassil Karam <[email protected]> wrote:
> >
> > > > > > > > I think I read somewhere that an int works a lot faster on
> gae,
> > > but I
> > > > > could
> > > > > > > > be completely mistaken. Anyone know? But otherwise, yeah: )
> >
> > > > > > > > On Nov 13, 2009 4:54 PM, "Rainer" <[email protected]>
> > > wrote:
> >
> > > > > > > > Okay, so I don't rely on googleKey, but instead, I create my
> own
> > > > > > > > unique key, like maybe a UUID ?!
> >
> > > > > > > > On Nov 14, 1:43 am, Bassil Karam <[email protected]> wrote:
> >
> > > Hey
> > > > > Rainer,
> > > > > > > > you don't need to read f...
> >
> > > > > > > > > On Fri, Nov 13, 2009 at 4:14 PM, Rainer <
> > > [email protected]>
> > > > > wrote:
> > > > > > > > > > > Guys, > > > Maybe ...- Tekst uit oorspronkelijk bericht
> > > niet
> > > > > weergeven -
> >
> > > > > > > - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit
> > > > > oorspronkelijk bericht niet weergeven -
> >
> > > > > > - Tekst uit oorspronkelijk bericht weergeven -
> >
> >
> >
>

--~--~---------~--~----~------------~-------~--~----~
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