🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #5017

Adding fields to an ADO DataSet (or recordset)

#5017
From: Jurko
Date: Wed, 22 Aug 2001 11:33
34 lines
2083 bytes
Question...

Is there a way to create many fields in an ADO Recordset at once?

If I do it the standard way (the way VCL does it when it creates
Recordset fields from TADODataSets field definitions) then I call

fields->Add() method for each of the fields in the Recordset...

Alas, that tends to have an efficiency problem...

I have a form with 15 datasets on it, each with about 30 fields...

creating 15 datasets is pretty much instant... (doesn't matter if I
let VCL do it or if I create the recordsets by hand with just one
COM Recordset Factory object...) but adding fields to the
recordset via the fields->Add() method seems to be badly
implemented...

All together I need to way about 2 seconds for the datasets to
initialize...

I tested the speed of fields->Add() and here's a benchmark...

To add 100 fields: about 0,5 seconds...
To add 400 fields: about 9 seconds...

hmmm seems to be that its reallocating memory for each added field...
is there a way to tell it at the begining how many fields there will be?
(haven't been able to find anything useful in MSDN or in the Borlands
help files)

Thanks for any helpful insights you might offer...
    Jurko
Technical Details
Message-ID: <3b83989a_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,a041946c4ff48308,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2001-08-22 04:42:35 PST
Reply-To: "Jurko" <Jurko@ve-mil.hr>
From: "Jurko" <Jurko@ve-mil.hr>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Adding fields to an ADO DataSet (or recordset)
Date: Wed, 22 Aug 2001 13:33:57 +0200
Lines: 36
Organization: Ve-mil
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
NNTP-Posting-Host: 195.29.221.130
Message-ID: <3b83989a_1@dnews>
X-Trace: dnews 998480026 195.29.221.130 (22 Aug 2001 04:33:46 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnews