[Gambas-user] Forbid DataSource to fetch certain fields

Bruce bbruen at ...2308...
Sat Sep 29 12:26:20 CEST 2012


On Sat, 2012-09-29 at 09:44 +0200, Tobias Boege wrote:
> On Sat, 29 Sep 2012, Tobias Boege wrote:
> > Hi,
> > 
> > rocko's recent question brought me back to a problem I once had:
> > We have a database at school which contains a lot of big blobs (PDFs of
> > student papers). It consequently takes an unneccessary amount of time to
> > load all the records in there. My question is hence: Can I tell the DataView
> 
> read the last word as: DataSource ;-)
> 
> > to only load certain fields from the database table? I think of some
> > DataSource.Columns property that does:
> > 
> > sReq = "SELECT " & DataSource.Columns.Join() & " FROM " & ...
> > 
> > I saw something similar in the DataTable.class source code but I couldn't
> > figure out how to get the $aKey there modified. I think you'll know better.
> > 
> > Can someone please point me in the right direction?
> > 
> > Regards,
> > Tobi

Hey Tobi,

We have had the same problem here.  That is, that blobs take a long time
to load.

I don't think this is a gambas "problem", as it is database independent
and I have traced through the code execution at fairly low levels (for
postgresql anyway).  It is actually due to the time it takes to buffer
and transfer the cursor within the database driver.

The solution we use is to split the database table, putting the blob
fields in a table associated to the main table by its primary key.  This
works for us because primarily 99% of the time we are not interested in
the blob data for a multi-row cursor.  It is only when the user wishes
to look at the associated blob data that we load the (single) row from
the associated table.

Your mileage may vary.  

regards
Bruce





More information about the User mailing list