Programming Notes
The following section lists notes about the OLE DB provider:
Visibility of Updates
Updates made to a table with adCmdTableDirect will be visible to a Command-based recordset.
For example, consider the following sequence of events:
In this scenario, the updates made using the transactional method are visible to the SQL query.
Using the OLE DB Provider with a UNC Path or Mapped Drive
This section describes a situation that occurs if you are using the OLE DB provider in conjunction with a mapped drive or UNC path in the Data Source portion of the connection string. For example:
Provider=PervasiveOLEDB;Data Source=\\servername\path
In the previous version of the provider, this connection string would automatically resolve to the correct database name. Using the current provider, you may encounter permissions issues with this configuration. You will not have any permissions issues if you use the new Location parameter in your connection string. See Remote Connections for more information on the Location parameter.
If a client tries to connect to a server, and the client's data source is a UNC path, the provider must resolve the path to a database name and server name. In order for the OLE DB provider to obtain this information, the client's user account must have Administrative or Power User permissions on the server in order to resolve this path.
In many configurations, the client’s user account may not have these necessary permissions. If the client does not have sufficient permissions, the OLE DB provider displays a dialog similar to Figure 4, allowing the user to enter the database name and server name.
Figure 4 Resolution Dialog for DBName and Server Name
If you check Save above settings to registry, then the entries will be saved to the Windows registry and Figure 4 will no longer display for the referenced UNC or mapped drive location. Instead, the database name will be resolved using the registry, which offers a performance improvement. The registry location used is:
SOFTWARE\Pervasive Software\OLEDB\Connections
If you as a developer want to avoid the display of this dialog to your end-users, you can enter the necessary information in the Windows registry, in the following format under the preceding key:
For example:
You can have multiple UNC entries that point to the same database name if necessary.
Support for ADO Refresh Method Examples
The following shows examples of the ADO Refresh method using a parameterized query and a stored procedure.
Example Using Parameterized Query
connstr = "Provider=PervasiveOLEDB;Data Source=Demodata"
cn.Open connstr
cmd.ActiveConnection = cn
cmd.CommandType = adCmdText
cmd.CommandText = "Select * From Room where Building_Name = ?"
'Refresh parameters
cmd.Parameters.Refresh
cmd.Parameters(0).Value = “Bartold Building”
cmd.Execute
Example Using Stored Procedure
connstr = "Provider=PervasiveOLEDB;Data Source=Demodata"
cn.Open connstr
 
' Call Stored procedure
cmd.ActiveConnection = cn
cmd.CommandText = "PROCOUT"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Refresh
cmd.Execute
Debug.Print cmd.Parameters(0).Value
Seek with Static Cursors
To use seek on a static cursor, the index must be set before opening the result set. For example:
Dim rs AsNew ADODB.Recordset
rs.Index = "segment"
rs.Open "Simple", "Provider=PervasiveOLEDB;Data Source=MyData", adOpenStatic, adLockOptimistic, adCmdTableDirect
rs.Seek Array(2, 9)
rs.Close
Remote Connections
The OLE DB provider cannot create a remote connection. This means you cannot set a remote server within the connection string. However, there are alternatives for our provider to perform the same functionality.
Dim m_busObj As projDLL.busObj
rs As New ADODB.Recordset
Set m_busObj = CreateObject("sampProj2.TwoPhaseSampleProduct", "RemoteServer")
Set rs = m_busObj.GetData()
Table Definitions
ITableDefinition does not support creation of the following columns because they are not supported by the underlying PSQL engine.
Default LockType
If no LockType is specified, the cursor is set to immediate update mode. This has a couple of repercussions:
Update and UpdateBatch really have no meaning (as the database is already updated). However, the Supports method will still return true of update, but will return false for UpdateBatch.
GetOriginalValue is not usable.
To programmatically determine when GetOriginalValue is available, you must use the "supports" method with adUpdateBatch as the argument. For example:
if rs.Supports(adUpdateBatch) then
someValue = rs.fields(iCol).OriginalValue
end if
Initialization Properties
The following table lists the properties PSQL supports for initialization in OLE DB, and the corresponding connection string identifiers
You can also set the following properties: