![]() |
PDB Database Classes | |
| Links Contact Us FAQ
Revision Log: 02/14/05 - Fixed Bug in UniCode to handle more all UniCode Blocks. 02/14/05 - Fixed Bug in ReadNextModified that ignored first record in the database 03/10/04 - UniCode support on strings. Handles a UTF-8 encoding and coding automatically 03/10/04 - Global ByteSwap flag to handle 68000 series byte format. Palm VFS storage. 03/10/04 - Fixed 3 Compile errors in classes |
These Classes will allow you to write PDB databases without using Appforge components. These classes are VB6 and are designed to work with desktop applications. Here is an example: Dim oPDB As New PDBDatabase
Dim oByteStream As New PDBByteStream
Dim oAppForgeHeader As New PDBAppforgeDefinition
Dim oAppForgeData As New PDBAppforgeRecord
' Creates a new database
If oPDB.CreateDatabase() Then
' Successful
oPDB.PDBDatabaseName = "test"
oPDB.CreatorId = "TEST"
' Creates the Appforge header
oAppForgeHeader.AddFieldName "Test", eStringField
' Writes a Record
Set oAppForgeData.AppforgeDefinition = oAppForgeHeader
oAppForgeData.StringValue(1) = "test"
' writes the record
Set oByteStream = oAppForgeData.ByteStream
oPDB.Update -1, 0, 0, 0, oByteStream.ByteArray
' Saves the data
oPDB.WriteAppInfoBlock oAppForgeHeader.AppInfoBlock
oPDB.CloseDatabase
Else
' failed
MsgBox "Failed to create"
End If
' Changes information in a database
oPDB.PDBDatabaseName = "AFSampleTable"
If oPDB.OpenDatabase Then
' Gets the Appforge file infor
Set oAppForgeHeader = New PDBAppforgeDefinition
If oAppForgeHeader.IsAppforgeData(oPDB.ReadAppInfoBlock) Then
' This is an appforge database. Setup the Appforge header
' information
Set oAppForgeData.AppforgeDefinition = oAppForgeHeader
' Updates the appforge data
Set oByteStream = New PDBByteStream
oByteStream.ByteArray = oPDB.ReadNextByIndex(1, 0, 0, 0)
Set oAppForgeData.ByteStream = oByteStream
Debug.Print oAppForgeData.BooleanValue(1) & " = True"
Debug.Print oAppForgeData.ByteValue(2) & " = 10"
Debug.Print oAppForgeData.CurrencyValue(3) & " = 55"
Debug.Print oAppForgeData.DateValue(4) & " = 1/31/2002"
Debug.Print oAppForgeData.SingleValue(5) & " = 1.3"
Debug.Print oAppForgeData.DoubleValue(6) & " = .5544332211"
Debug.Print oAppForgeData.IntegerValue(7) & " = 340"
Debug.Print oAppForgeData.LongValue(8) & " = 45300"
Debug.Print oAppForgeData.StringValue(9) & " = Hello"
oAppForgeData.StringValue(9) = "test"
' writes the record
Set oByteStream = oAppForgeData.ByteStream
oPDB.Update 1, 0, 0, 0, oByteStream.ByteArray
Else
' Not Appforge
MsgBox "Not an Appforge Database"
End If
' Save changes
oPDB.WriteAppInfoBlock oAppForgeHeader.AppInfoBlock
oPDB.CloseDatabase
Else
MsgBox "Failed to open " & oPDB.PDBDatabaseName
End If
The zip file you receive will include a sample form and all class with source code for creating PDB databases. |
|