Skip to main content

Tales from an Admin Perspective: Code Sleuth

We had a database that we kept getting complaints about, it kept getting slower and slower to do a specific task. I tracked it down to this code.

Can you spot this issue with this code?

Sub assignAclToSubRecord( viewName, docID )
    Dim counter As Integer
    Set vwSub = db.GetView( viewName )
    Set subDoc = vwSub.GetDocumentByKey( docID )
    Do While Not ( subDoc Is Nothing )
        subDoc.Authors_Variable_SpecificTI  = currentDoc.Authors_Variable_SpecificTI
        subDoc.AuthorsVariable = currentDoc.AuthorsVariable
        Call subDoc.Save(True,True)
        Set subDoc = vwSub.GetNextDocument( subDoc )
    Loop   
End Sub

Comments

  1. The coder presumably intended to get a document *collection* matching some docID key and loop through just those docs. The code as is would loop through every doc in the view after the first key match, which would be an increasingly burdensome process as the number of documents increased over time.

    ReplyDelete

Post a Comment

Popular posts from this blog

Fun Little Earthquake

It's 1:45pm EST in Ottawa, Ontario, Canada. We just had an earthquake.  Not strong enough to damage anything, but enough that I watched people run out of buildings. What a fun Wednesday.

Error 217 - Error creating product object on Domino 64 bit

I'd like to share something with you.   An error that you'll get if you are trying to use ODBC with Domino 8.5.1 64bit. It starts out with an agent error of Error 217.  The text of the error is "Error creating product object" You can read about it here on the Notes/Domino forum . You can find the solution here as well . I guess I'm now waiting for Domino 8.5.2 for a solution for this.   It would have been nice to have had this in the release notes.  It would have help me greatly.

Lotus Trading Cards

I was painting the house last night, and my mind got to wandering... Bruce Elgort mentioned on Twitter last night that he was thinking of a VC fund for Lotus projects. So my mind wandered about that, and turned to how we present ourselves. I got to thinking that business cards are so ... old school. I think we need Trading Cards. So, here are the first few I've come up with.