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