Jump to content
Sign in to follow this  
marko001

[SOLVED] - Strange delay in loading .ado objects

Recommended Posts

marko001

Hi all,

I call a .xml file in this way:

If FileExists($myxmlfile) Then
                If $call_ado = 0 Then
                    _ADOCalls($myxmlfile)
                    $call_ado = 1
                EndIf
                _PopulateListView()
             GUISetState(@SW_SHOW, $DB_GUI)
         Else
            EndIf

Func _ADOCalls($file_xml)
    With $adoRsItems
        .CursorLocation = 3; adUseClient
        .CursorType = 2; adOpenDynamic
        .LockType = 3; adLockPessimistic
        If FileExists($file_xml) Then .Open($file_xml)
    EndWith
EndFunc   ;==>_ADOCalls

Func _PopulateListView()
    _GUICtrlListView_DeleteAllItems($hListView)
    If $adoRsItems.EOF() Then
        $adoRsItems.Filter = 0
    EndIf
    $adoRsItems.MoveFirst()
    $J = $adoRsItems.Fields.Count() - 1
    While Not $adoRsItems.EOF()
     $Txt = ''
        For $I = 0 To $J
            $Txt &= $adoRsItems.Fields($I).Value & "|"
        Next
        If $sets[UBound($sets) - 1] <> $adoRsItems.fields(1).value Then _ArrayAdd($sets, $adoRsItems.fields(1).value)
        GUICtrlCreateListViewItem(StringTrimRight($Txt, 1), $ListView)
     $adoRsItems.MoveNext()
    WEnd
    GUICtrlSetData($LVNumber, _GUICtrlListView_GetItemCount($hListView))
EndFunc   ;==>_PopulateListView

I load 14,000 records.

If I use _arraysort($mydb) before writing data to .xml, the loading time becomes horrible (around 40 secs vs 8 secs)

(I need it sorted since I use _arraybinarysearch() to look for datas there and eventually change them.)

_ArrayConcatenate($dest, $new_added, 1)
                _ArraySort($dest)  ; <----------------------  Not needed here but I add since in previous lines it has been called
                _ArrayAdd($dest, "</rs:data>")
                _ArrayAdd($dest, "</xml>")
                _FileWriteFromArray($myxmlfile, $dest, 1)
            EndIf
                While FileOpen($myxmlfile) < 0
                    Sleep(1)
                WEnd
            _appendtemplate("headers")

How to solve it?

M.

Edited by marko001

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • nooneclose
      By nooneclose
      I need help turning this string "20180913221626" into a formatted time string.
      I need to go from this: 20180913221626
      to this: 09/13/2018 10:16 PM
      I do not always know what the date will be so I can not just use a variable I need to actually convert/format. 
      I did see an older post in the forms that was basically the same question only the other guy did not post the working code and I can not figure out how to use _AD_GetObjectProperties properly to get what I want. 
      As always any help would be appreciated. 
      Here is the code I use to find the date, but it always gives me the unformatted version. 
      ;retrieve the items object $oItem = $oOutlook.Session.GetItemFromID($aItems[1][0], Default) $oItem.GetInspector $eSentOn = $oItem.SentOn ; When was the email sent? MsgBox("", "Sent On of the email", $eSentOn) ;******************************************************************************* ; Formats the date and time from the email ;******************************************************************************* ;Local $fDatenTime = _DateTimeFormat($eSentOn, 1) ;MsgBox("", "Formatted email time", $fDatenTime) $aProperties = _AD_GetObjectProperties($eSentOn) _ArrayDisplay($aProperties, "Did the conversion work?")  
    • Miliardsto
      By Miliardsto
      I got that func
      Func makeHelpImgGUI($title,$width,$height,$img) $img = GUICtrlCreatePic("",20,40,$width,$height) _ResourceSetImageToCtrl($img, "HERE") EndFunc and I call this func like that
      makeHelpImgGUI("Image",1190, 800,$SETTINGS_JPG)  
      so what is the problem in the parameter where is - "HERE" I need value of img but passed as string
      so $img = $SETTINGS_JPG and how make it "SETTINGS_JPG"
       
      I tried something like that but not work
      Func makeHelpImgGUI($title,$width,$height,$img) $name_str = String($img) $name_str = StringTrimLeft ($name_str, 1 ) $img = GUICtrlCreatePic("",20,40,$width,$height) _ResourceSetImageToCtrl($img, $name_str) EndFunc  
    • liagason
      By liagason
      Hello everyone,
      How can I display in ascending  sequence some numbers stored in a string variable?
      $str = "18,03,48,23" MsgBox(0,"test",$str) I would like it to display "03,18,23,48"
    • Rskm
      By Rskm
      Hi, I have the following line in a text file 'input.txt'. I know the line number - say '6'. I wish to replace the text 'WWW' in the below line with a random number (I can generate that with random()).
      WERIS  WWWJP   3.83  8.330  1.000                1097.RAXX 
      The WWW is a 3 digit integer (could be any number between 0 to 999), I can use stringtrimleft and get the numerical value of WWW in this file
      so, basically, I know the string to replace (ie; WWW stored in a variable), I know the line number to work on and the file location/name and the replacement variable (through random()). My requirement is to fill that 3 spaces with my random number (which Is a integer between 1 and 999)
      please put ur suggestions
       
    • nacerbaaziz
      By nacerbaaziz
      Hello Members of this best Forum
      i have a question please
      for example if i have a long string
      and i want to extract a text between two tag
      what i can do to make that?
      note :
      i know that there is a
      StringRegExp function
      it's do that work
      but it result is be as an array
      i want the result to be a string
      is there any function on autoit can do that?
      Thanks in advance.
×