Article View: borland.public.cppbuilder.database.ado
Article #2927Re: Creating Access DB in Builder
From: Mike Ruskai
Date: Tue, 04 Feb 2003 09:20
Date: Tue, 04 Feb 2003 09:20
35 lines
2942 bytes
2942 bytes
On 3 Feb 2003 15:04:53 -0800, Don Wilcox wrote: >Is it possible to create a new .mdb file from within a C++ program? I can use SQL to create tables, but verything I have found requires an >existing file. You need to import the ADO extensions type library. I don't recall the exact name, but it's something like "Microsoft ActiveX Data Objects 2.7 DDL and Security". You'll know the correct one by which components it includes. You need TCatalog as the bare minimum to create the Access .mdb file. Since there are already TTable and TColumn classes in VCL, when importing that library, I renamed each component from T<whatever> to ADO<whatever>. I found that creating a table via SQL results in the table data itself taking up about twice as much space as it's supposed to, and taking twice as long to search through. I don't know why this is, but when the same exact table definition is created via ADOX, the table size and speed is normal. Needless to say, this is after compacting that the size comparison is made, since creating and populating an Access database will give you a file almost twice as large as it is after compacting. As an example, a table with about 230,000 records (around 600 bytes per record) ended up with a total compacted database size of about 270MB (table and a few indexes). That's when the table is created via SQL. When the table is created via ADOX, the final compacted database size is around 150MB. Doing a search that causes a table scan takes twice as long (if not longer) on the SQL-created table versus the ADOX-created table. Everything is identical except the mechanism used to create the table definition. In both cases, the indexes were created via SQL. If you're not dealing with large quantities of data, it may not matter. -- - Mike Remove 'spambegone.net' and reverse to send e-mail.
Technical Details
Message-ID:
<gunaalqrneguyvaxarg.h9s1xy0.pminews@207.105.83.65>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!easynet-quince!easynet.net!newsfeed.hostname.nl!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3e3ef595$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,cf0428e56f70fa7d X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-02-04 01:39:04 PST Newsgroups: borland.public.cppbuilder.database.ado From: "Mike Ruskai" <spamten.knilhtrae@begonedynnaht.net> Message-ID: <gunaalqrneguyvaxarg.h9s1xy0.pminews@207.105.83.65> References: <3e3ef595$1@newsgroups.borland.com> Date: Tue, 04 Feb 2003 04:20:22 -0500 (EST) Reply-To: "Mike Ruskai" <spamten.knilhtrae@begonedynnaht.net> X-Newsreader: PMINews 2.00.1205 For OS/2 Organization: TLF MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: Re: Creating Access DB in Builder NNTP-Posting-Host: 65.40.242.248 X-Trace: newsgroups.borland.com 1044350422 65.40.242.248 (4 Feb 2003 01:20:22 -0800) Lines: 37 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!easynet-quince!easynet.net!newsfeed.hostname.nl!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail