It is currently Fri Nov 22, 2019 4:58 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Clear empty sessions from Session History
PostPosted: Fri Feb 26, 2016 10:56 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1675
I really like the Session History feature, but it seems silly that it saves "empty" sessions (no file activity).
It's harmless, but it really clutters up the dropdown list of sessions!

Yes, empty sessions occasionally happen. Maybe I pop open the IDE, then get distracted and don't edit anything.
Over time, I can build up 50+ quick empty sessions in my History list!


In the meantime, I wrote an invisible IDE tool to delete empty sessions at startup:
Code:
; Build, add to IDE Tools with "Editor Startup" trigger
;
File.s = GetPathPart(GetEnvironmentVariable("PB_TOOL_Preferences")) + "History.db"
If (FileSize(File) > 0)
  UseSQLiteDatabase()
  If (OpenDatabase(0, File, "", ""))
    NewList SID.s()
    If (DatabaseQuery(0, "SELECT session_id FROM session"))
      While (NextDatabaseRow(0))
        AddElement(SID())
        SID() = GetDatabaseString(0, 0)
      Wend
      FinishDatabaseQuery(0)
      ForEach SID()
        If (DatabaseQuery(0, "SELECT COUNT(*) FROM event WHERE session_id='" + SID() + "'"))
          If (NextDatabaseRow(0))
            Count.i = GetDatabaseLong(0, 0)
            If (Count = 0)
              DatabaseUpdate(0, "DELETE FROM session WHERE session_id='" + SID() + "'")
            EndIf
          EndIf
          FinishDatabaseQuery(0)
        EndIf
      Next
    EndIf
    CloseDatabase(0)
  EndIf
EndIf

_________________
On GitHub: PB Includes - IDE Tools - Color Themes


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye