IsLoaded event

Hello Tim,

I have to find out, the SQL statement is a simple select from one table, no joins or whatever.
Every record contains the original filename and size/date and the data in a blob, but the blob isn’t read, only the text fields.

Hi Karen,

will take a look in your ThreadYieldInterval,

thanks

Something’s not right here. Above you said it’s 1.6GB of data in 7000 records, but now you are saying they are just filenames, dates and sizes. That doesn’t add up. Are you sure you aren’t pulling down the blobs as well?

Are you being selective with which fields you are pulling in with your SQL select statement?

My understanding is that you have a DB that is 1.6GB which contains the filenames, sizes and also a blob of the actual file data. I assume that your listbox only requires the filename and size in it so when you click on the listbox row to load the file, the blob is then retrieved from the DB?

When you are populating the listbox, is your select statement only asking for the filename and size fields? If you are doing something like “SELECT * FROM table_name;” then it will also be pulling the blob data too, which you probably don’t need at that point. So you’ll be reading the entire 1.6GB from the DB when you probably only need to read a few hundred K for the filenames and sizes. You’ll need to do something like “SELECT FileName, FileSize FROM Files;” instead. Note I don’t use SQL in Xojo, only in PHP, so my syntax may not be exact but the principle stands. Only pull what you are actually using from the DB or you’ll be wasting memory and processor time.

On the updating UI from a thread issue, I have an app that populates a listbox from a large XML file in a thread. What I do is parse the XML file into a temporary dictionary in memory and have a timer on the UI that pulls the data from that dictionary at intervals and removes each item as it’s added to the listbox. The timer keeps going until both the thread is finished and the dictionary is empty. Works well and allows the thread to work at a speed independently of the UI update. Also means that you can fire the thread whenever you want without worrying if the UI is fully loaded as all it will do is fill up the dictionary. The dictionary will sit in memory initially, so once the UI is loaded and the timer kicks off it will start pulling the data from the dictionary into the listbox.

Hello Richard and others,

I was staring at this Listbox load procedure, while the SQL statement was created in another method. I was pretty sure it pulled only the text columns out of the database.

Until I looked it up… shit! It was a “select * from” statement. Pfff… When I changed it to pull only the text columns the listbox loaded in about a second… Soooooo stupid!

Thanks for all your effort. Still learned some things though…