This is more a matter of programming taste ...
I have a Database DLL that is calling into Access through OLEDB, and exposes
functions like AddPerson(STRING szFirstName, STRING szLastName, INT uAge)
etc.
Now I want to interrogate it in this manner:
GetPersonsBetweenAges(INT uLowerAge, INT uUpperAge, ..),
and get back a recordset of Persons.
What is the "nice" way to implement?
(1) Pass back a naked pointer to the recordset:
GetPersonsBetweenAges(uLowerAge, uUpperAge, Persons **ppPeople),
allocate the memory to the recordset in the DLL, and expect the caller to
free it. Messy. Caller has to free memory, much type information has to
cross object bounds.
(2) Return pointer to IEnumXXX interface:
GetPersonsBetweenAges(uLowerAge, uUpperAge, IEnumPersons **ppPeople),
Seems better but still need to manage object lifetime, and I can get a lot
of IEnumXXX interfaces to deal with ....
What is the "nice" c-plus-plussie way to pass a recordset across an object
boundary?
Thanks.
Eric 1 1781
Well, I'm not a C expert, but couldn't you use a Typed Pointer to a
Recordset? http://www.codeguru.com/atl/ATLnADO.html
Microsoft has a novel approach in ADO 2.8. The Microsoft Visual C++
Extensions for ADO associate, or bind, fields of a Recordset object to C/C++
variables. http://msdn.microsoft.com/library/de...gramming_8.asp
"Rufus DeDufus" <sp*************@hotmail.com> wrote in message
news:10*************@corp.supernews.com... This is more a matter of programming taste ... I have a Database DLL that is calling into Access through OLEDB, and
exposes functions like AddPerson(STRING szFirstName, STRING szLastName, INT uAge) etc.
Now I want to interrogate it in this manner: GetPersonsBetweenAges(INT uLowerAge, INT uUpperAge, ..),
and get back a recordset of Persons.
What is the "nice" way to implement? (1) Pass back a naked pointer to the recordset:
GetPersonsBetweenAges(uLowerAge, uUpperAge, Persons **ppPeople),
allocate the memory to the recordset in the DLL, and expect the caller to free it. Messy. Caller has to free memory, much type information has to cross object bounds.
(2) Return pointer to IEnumXXX interface:
GetPersonsBetweenAges(uLowerAge, uUpperAge, IEnumPersons **ppPeople),
Seems better but still need to manage object lifetime, and I can get a lot of IEnumXXX interfaces to deal with ....
What is the "nice" c-plus-plussie way to pass a recordset across an object boundary?
Thanks.
Eric
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Malcolm Cook |
last post by:
Hi,
I've created and installed a custom UDF to populate my combobox, and have
defined it per :...
|
by: JingleBEV |
last post by:
Hi all,
I am trying not to use global variable to maintain data consistency. Some
procedures and functions will require to pass the recordset object for
processing and functions may also return...
|
by: Lyn |
last post by:
Hi,
I have been experiencing a problem passing a LIKE statement in the WHERE
argument of a DoCmd.Openform statement. I have posted that issue
separately.
However, in an attempt to work around...
|
by: Zlatko Matić |
last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL
Server) and that we want to execute some parameterized query as a
pass.through query. How can we pass parameters to the...
|
by: Andrew Mueller |
last post by:
Hello,
I tried this question prior and got no response, so thought I would try
to explain differently..
I am not sure which type of object to pass between a VB 6.0 ActiveX dll and
C#. I am...
|
by: martin |
last post by:
Hi,
I am just about to deploy my production application on a win2k server with
two processors.
I have been reading that inprocess session state is not the best method for
multi processor...
|
by: Ted Ngo |
last post by:
I want to use the .net Web Service to create a function and return the
datas (RecordSet). And want to retrived those data on the classic ASP.
Does any body have some example of this. How to create...
|
by: slowmotiongenius |
last post by:
All-
I have established an adodb recordset in my code-behind, and I need to
pass it to the aspx file. I can't seem to figure out if there is a way
to do this. I see you can pass a string over...
|
by: techbuddha |
last post by:
Hi new to the forum and visual basic.
I am attempting to fix a migration of excel to access. The excel sheets where simple copied as is into access. for example one table lists the academic...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |