Love

... duplicated through their class constructor in MFC or the C runtime library function strdup(). Once you've obtained the copy, you use both it and the original as two totally distinct elements, completely forgetting how you came to get them. But with ADO Recordsets, for example, you see a radically different set of features. In .NET, clonation is supported through the ICloneable interface. Some objects implement it natively, while others limit their clonation capabilities to shallow copy. For those objects, a deep copy can be realized only manually. (More on this later and in part 2.) In this two-part article, I'll first review the clonation support in ADO and ADO.NET. Next, I'll discuss a famous case that's been in the news a lot lately with all the talk about cloning humans—the case of Dolly. As you may already know, Dolly is the name of the first DataTable object that I ever attempted to duplicate in my Beta 1 code. To start off, let's hear the ADO point of view on cloning tables . ADO on Recordset Clonation An ADO Recordset can be happily cloned using the method Clone. You use Clone if you want to duplicate an existing Recordset—that is, you want a second Recordset with another variable name, but the same content. Of course, using Clone is faster than initializing and filling a new Recordset through connection and command objects. What you actually get from the clonation process is a pointer to the same data that is programmatically available through a distinct Recordset object. This fact has a number of pleasant and less pleasant side effects. In short, once you've obtained the copy of the Recordset, you cannot simply use both instances at your leisure. Instead, you must be aware of a number of peculiarities and handle them with extreme care. A pleasant aspect of a cloned Recordset is the limited overhead required for creating and using it. A cloned Recordset is only an object variable with a reference to the original Recordset data. In addition, the cloned Recordset holds a separate buffer for keeping track of bookmarks. In other words, they can be navigated independently an...

Essay Information


Words: 707
Pages: 2.8
Rating: None

All Papers Are For Research And Reference Purposes Only. You must cite our web site as your source.