Home | Components | Contact Me
 

Compact Data Pak
rtCDP.dll

Overview | Summary | Reference | Purchase

Features:

- Create and manage databases (over 2 billion records) with ease
- Transmit entire databases or (any size) message blocks over a network and reassemble them on the other end in just a few method calls
- Create, manage, and store state information for your applications on the hard drive with ease
- Create your own virtual directory systems or application registries by storing an entire database within a single record of another database
- Quickly store and retrieve in-memory databases or state information for your application just as you would with a PERL associative array, but with many additional options
-
. . .
 

Real-World Examples
in Visual Basic

First, lets create a database:
Dim DB As New rtCDP.crtCDP

Now let's add some records:
DB.Append "First Name", "Bob"
DB.Append "Last Name", "Smith"
DB.Append "Zip Code", "34653"

Here's the database now:

Rec # Key Data
0 First Name Bob
1 Last Name Smith
2 Zip Code 34653

Records are stored internally like an associative array, but, unlike an associative array, they retain their record order—like a database.

Now, modify an existing record's value:
DB.Data("First Name") = "Robert"

Here's the database now:

Rec # Key Data
0 First Name Robert
1 Last Name Smith
2 Zip Code 34653

Here's an easy way to append another record:
DB.Data("Area Code") = "727"

Here's the database now:

Rec # Key Data
0 First Name Robert
1 Last Name Smith
2 Zip Code 34653
3 Area Code 727

You can retrieve record values based on key or record number:
MyString = DB.Record(1)
'MyString now equals"Smith"

MyString = DB.Data("Zip Code")
'MyString now equals"34653"

It's easy to delete records either using the record's record number or its key:
DB.DeleteRec 2
'"Zip Code" record was just deleted
DB.Delete "Area Code"
'"Area Code" record was just deleted

Here's the database now:

Rec # Key Data
0 First Name Robert
1 Last Name Smith

Let's insert a record:
DB.Insert "MI", "J", "Last Name"
'New record was just inserted before "Last Name" record

Here's the database now:

Rec # Key Data
0 First Name Robert
1 MI J
2 Last Name Smith

You can save binary data as easily as you would a string:
DB.DataB("Picture") = MyByteArray

Here's one of the really cool things. You can package the entire database into a byte array, transport it over a network or save it to disk. Then completely restore it at a later time. For example:
Dim MyDB() as Byte
MyDB = DB.BLOB
'MyDB now contains an exact copy of DB but as a byte array

Now we can transport the database over a network or just store it to disk with a couple VB commands.

'To restore the entire database on the receiving end, just do this
Dim DB2() As New rtCDP.crtCDP
DB2
.BLOB = MyDB

'Now, DB2 contains the entire original database. For example:
MyString = DB2.Data("First Name")
'MyString now equals "Robert"

We are just scratching the surface. The Compact Data Pak supports multiple Find properties, internal arrays, and some other powerful stuff.

Take time to look over the documentation to get a better idea of the full capabilities of this powerful little object.

 
. . .

This amazing object stores data internally like a database, but is able to pass the entire database in binary format as a byte array. This allows you to save the entire database to disk, transmit it over a network (or the Internet), or even pass a pointer to it from any function in your program.

Passing a pointer allows you to give any number of functions in your application access to all the entire database in the time it takes to declare an object and pass a long integer.

Once you've converted the database to a byte array and saved or transported it, you can then convert it back to a completely functional database by calling a single property of the object (Obj.BLOB).

Because this object can quickly and efficiently recreate itself, you can utilize it to create your own RPC (remote procedure call) protocol and allow your own clients and servers to talk to each other over a network, or on the same machine.

You can even setup your own messaging system for the transport of mail. ...And because the Compact Data Pak can package binary data as easily as string data, you can transport any kind of data, including digital audio and video.

If you've ever needed your application to manage small to mid-sized databases but didn't want to wrestle with the complexities of ADO, RDO, or the nightmare (and bulk) involved in distributing MDAC (Microsoft Data Access Components), the Compact Data Pak will save you a lot of time and trouble.

Because it's so flexible, I use the CDP for several different functions within my latest commercial application.

First, I use it for internal databasing; It keeps track of what documents are available to the user, and which documents are open at any given time.

I also use it as a document header that stores various details about the document it is attached to, such as margin settings, the document title, usage information for the document, and security information such usernames and passwords for the document. I simply attach the binary output (of the Obj.BLOB property) to the beginning of the document.

When the document is opened, I restore the entire database from the top of the document to its original form with a single method call (the object automatically saves it's length in the binary block of data it returns from the Obj.BLOB property) Now, all the document's data is available in a highly-organized—easy to retrieve database format just as was when it was saved.

I've also used this DLL to make chat servers and clients (for my own experimentation). Using this DLL, it's really easy because you can stuff the users typed message in a record with some predetermined name (like "Message"). Then, using the Winsock (TCP/IP) control that comes with Visual Basic, send the entire package off to the recipient. The recipient reassembles the database, then gets the text from the predetermined field and displays it in the chat window. The receiving process takes 3 function calls:

Dim dB As New rtCDP.crtCDP
DB.BLOB = TCP.GetData
txtChat.Text = DB.Data("Message")

Of course, there is a little more to the entire chat client than that, but because of this DLL, the message exchange is really is easy.

There is so much more you can do with this DLL that once you get it, I believe you will find it is an indispensable tool for all of your applications.

Please feel free to check out the documentation, as it is loaded with tons of useful examples!

If you have any questions about the functionality of this DLL, feel free to contact me.

Copyright 2001 Russ Tanner