Re: [AgileWiki] Query never ends
Status: Beta
Brought to you by:
blaforge
From: Bill la F. <laf...@ya...> - 2006-05-30 08:38:45
|
Sougata, Never fear, it is always good to hear from you. And of late, the discussion list(s) have been a bit too quiet, so it is especially good to hear from you. I'll look at your code tonight or tomorrow morning, with pleasure! As for your question, my answer is that this is not a RDBMS, but rather it is an OODBMS. So there is no record. There are objects with various kinds of attributes. Though to be fair, in TKS I refer to record ids, but they are more correctly named in ArkDb as rolon ids. Now when you do the add entry command, the current context will be the rolon to be updated. You are assured this because in the init method of the command, you attach the command to the SiimpleLedgerRolon class. (The init method is called when the program starts--commands are singletons.) You can then get the Rolon class (the data proxy) like this: SimpleLedgerRolon slr=(SimpleLedgerRolon)session.getContext(); Now because slr inherits from TableRolon, you can use the accessor methods on TableRolon to manipulate the document property. The value of the document property is a text document in comma separated form. To update it (in evaluateForm), you just call: slr.setDoc(newvalue); You can also access the content this way: List<List<String>> content=slr.getContent(Timestamp.NOW); (Note that ALL queries require a timestamp, while updates ASSUME a time of Timestamp.NOW, which is current time.) You may also consider using the columnIndex and getCellInRowNoBraces methods defined in TableRolon. Note that the first list in the list of lists returned by getContent is the list of column names. And when you call setContent(newvalue), the first line must be the column names separated by commas. Now as for a bit of what's going on.. You will see that getContent access class org.agilewiki.ark.TableContent. This is a cache object. It makes queries fast, but creates a problem when you make changes. This is handled in TableRolon.setDoc by the call to invalidateContent, which purges the old content from the cache. Another thing you will see are references to decRef. This has to do with reference counting used to manage cache objects. When you access a cache object, its reference count is automaticly incrimented, so getContent does a decref right after making a copy of the data it wants. I hope this is helpful. No doubt it will lead to more questions, but you know my prefered approach--code a little, learn a little. I also like frequent code reviews--it is important to nail misconceptions early. Now, just to go a very small bit deeper, TKS maintains simple property/value pairs, tables of key/value pairs and inverted tables of key/value pairs. These are largely distinguished by naming conventions. Looking in another direction, there are only a few caches maintained by the ark: TableContent, Pathname and Topics. Additionally, TKS maintains a cache of tables of key/value pairs. But note please that the TKS tables have absolutely nothing to do with Ark-level tables, which are really just csf documents. At an even lower level, btree keeps a cache of btree nodes. The important thing to remember about all caches is that they are transactionally aware. So if you make a change that gets recorded in a cache in the context of a transaction which subsequently gets aborted, the cache is automagicly cleared for you, as well as having the database restored to its prior value. And the thing to remember about transactions is that they can be nested. So you can partially undo and still continue. Its lots of fun. Enough? :-) Bill --- sougata bhattacharya <sou...@ya...> wrote: > Hi Bill, > I guess I am very poor so my query never ends. But > this is my style I never stop asking question. I > always want to know in and out of every > funtionality. Please don't get frastrated. > Here I am enclosing the Add entry form and Cmd. I > could test it because of I guess yesterday I didn't > check out whole code , partly I did. Anyway I will > test it today. > I think the code for inserting data is not > correct. > Now the question, > Could you please let me know how do you retrieve > a record(Rolon) for a given serach criteria and how > do you save or update? > Cheers > Sougata > > > Thanks > Sougata > Cell +919342501276 > > > --------------------------------- > Send free SMS to your Friends on Mobile from your > Yahoo! Messenger Download now Send instant messages to your online friends http://in.messenger.yahoo.com |