>>Hi everybody,
>>
>>Is there any way to speed up retrieval of record source? E.g. I have this code
>>
>>rs = loConn.Execute(m.ldapStr)
>>do while !rs.eof
>> store "" to lcCN, lcsAMAccountName, lcDepartment, lcEMail
>> oUser = getobject(rs.fields(0).value)
>> lcCN = upper(nvl(m.oUser.cn,""))
>> lcsAMAccountName = upper(nvl(m.oUser.sAMAccountName,""))
>> lcDepartment = upper(nvl(m.oUser.department,""))
>> lcPhoneNo = upper(nvl(m.oUser.telephoneNumber,""))
>> insert into (m.tcCursorName) (cFullName, cuserid, cDepartment, cPhone) ;
>> values (m.lcCN, m.lcsAMAccountName, m.lcDepartment, m.lcPhone)
>> rs.MoveNext()
>>enddo
>>
>>Is where a way to speed it up?
>>
>>Thanks in advance.
>
>I do not know, but for starters you can move the STORE out of the while loop, doubt it will be of great impact thou, and may be open m.tcCursorName with some alias to avoid the named expresion to be evaluated in the loop?
>
>
>use (m.tcCursorName) again alias myCursor shared in 0
>...
>insert into myCursor.....
>
>
>Anyways, I believe the GetObject is slowing down the execution, so I doubt this would have any impact
Thanks, Hugo, I didn't notice I was doing store inside the loop.
As for the other point, I don't think I can use my cursor again, since I have in the beginning:
create cursor (m.tcCursorName) ( cFullName C(100), cuserid C(100), ;
cDepartment C(100), cPhone C(100))
Is there any alternative way to read Rs? I believe we have some programs in our framework RsToDBF and vs., but I haven't looked into them closely.
UPDATE.
I've checked the code in our RsToDBF program and I see slight difference:
rs.absolutePosition=lnCount
FOR lnCount2 = 1 TO lnFieldCount
oField=rs.fields(lnCount2-IIF(llRecNoColumn,0,1))
lcField=oField.name
lvValue=oField.value
next
I guess setting absolute position and MoveNext should be equal in speed.
Now, since I don't know fields positions in the original record set, can I get their values using their names? I don't remember the syntax, but this would eliminate need for oUser and getobject. However, I don't think it would give me much of a speed gain anyway.
We're talking less than a minute for the total execution time, so may be I just have to live with the current speed.
If it's not broken, fix it until it is.
My Blog