The RDTA.PickDP.Connector library contains components required to communicate directly with the back-end database. It provides the ability to manage connections that use the database, tables, items, and fields and generate record sets from a database.
|
Class |
Description |
|
Database or Pick account. | |
|
Column of data from a connItem or connRecordSet. | |
|
Pick item. | |
|
Record set created by querying a connDatabase. Used when accessing data in record sets. | |
|
Table in a database or a file in a Pick account. Use when accessing data a single document at a time. |
Tables can be accessed by using the record set or record at a time methods.
If the record set view is used, a connRecordSet Object is created from the connDatabase and the connFields are used to obtain the fields in each record set row.
If the record at a time method is used, a table is accessed via a connDatabase Object and individual documents are accessed via a connItem Object, allowing the manipulation of individual connFields.
Example 1 below is an example of record at a time access. Example 2 is an example of access through a record set.

The connCommunications class inherits from java.lang.Thread. All other classes in RDTA.PickDP.Connector inherit from System.Object.

The following subroutine:
opens a connection and database.
lists the tables in the database.
reads and lists the contents of an item.
Dim myEnumerator As System.Collections.IEnumerator
Dim connection As connection ' a connection
Dim db As connDatabase ' a database via a connection
Dim table As connTable ' a table in a database
Dim item As connItem ' an item in a table
Dim fields() As connField ' an array of fields
Dim field As connField ' a field
Dim tableNames() As String ' list of tables in the database
connection = New connection() ' define and set up a connection to a database
connection.Host = "localhost" ' set system on which the Pick Data Provider inetd service is running
connection.Port = 3468 ' set the port on which the Pick Data Provider inetd service is listening
connection.User = "admin" ' set the username and password
connection.Password = "admin"
connection.Database = "SQLDEMO" ' set the database to open
connection.open() ' open the connection
If Not connection.isConected Then
MessageBox.Show("Cannot open connection")
Return
End If
tableNames = connection.getTableNames ' obtain a list of tables in the database
If tableNames.Length = 0 Then
MessageBox.Show("No tables present")
Else
System.Console.WriteLine("Tables:")
myEnumerator = tableNames.GetEnumerator()
While myEnumerator.MoveNext() ' list the tables
System.Console.WriteLine(myEnumerator.Current)
End While
End If
' list an item from a table
db = connection.getDatabase() ' get database from connection
table = db.getTable("customers") ' get a table in the database
table.open() ' open the table
If Not table.isClosed Then
item = table.getItem("1") ' get item from the table
fields = item.getFields() ' get fields in the item
myEnumerator = fields.GetEnumerator() ' list the fields
System.Console.WriteLine("Customers 1 data")
While myEnumerator.MoveNext()
field = CType(myEnumerator.Current, connField)
System.Console.WriteLine(field.getValue) ' display
End While
End If ' open failed
connection.close() ' close the connection
End Sub
'subroutine to open a connection and database
'create a record set from part of the data in a table
'read and display the selected data
Dim myEnumerator As System.Collections.IEnumerator
Dim connection As connection ' a connection
Dim db As connDatabase ' a database via a connection
Dim rs As connRecordset ' a record set
Dim fields() As connField ' an array of fields
Dim field As connField ' a field
Dim index, count As Integer ' local counter and index
Dim output As String = "" ' builds a single line of displayed data
Dim record As connRecord ' a record from the record set
'define selection criteria
Dim table As String = "CUSTOMERS"
Dim criteria As String = "WITH STATE = ""TEXAS"""
Dim sort As String = "BY CITY"
Dim columns As String = "state city postalcode" 'case sensitive
connection = New connection() ' define and set up a connection to a database
connection.Host = "localhost" ' set system on which the Pick Data Provider inetd service is running
connection.Port = 3468 ' set the port on which the Pick Data Provider inetd service is listening
connection.User = "admin" ' set the username and password
connection.Password = "admin"
connection.Database = "SQLDEMO" ' set the database to open
connection.open() ' open the connection
If Not connection.isConnected Then
MessageBox.Show("Cannot open connection")
Return
End If
db = connection.getDatabase() ' get database from connection
rs = db.select(table, criteria, sort, columns) 'select the data
count = rs.getRecordCount - 1 ' adjust for zero based index display number of documents selected
Debug.WriteLine(rs.getRecordCount & " selected")
Debug.WriteLine("Fields:")
For index = 0 To count
record = rs.getRecord() ' get a row of data
fields = record.getFields ' get all of the columns
output = index.ToString & " "
myEnumerator = fields.GetEnumerator()
While myEnumerator.MoveNext()
field = CType(myEnumerator.Current, connField)
output = output + " " + field.getValue
End While
Debug.WriteLine(output)
output = ""
rs.moveNext() ' next row
Next
connection.close() ' close the connection
End Sub
The RDTA.PickDP.Connector library includes these classes:
|
Dictionary definition for a column. | |
|
Defines the constants used by the RDTA.PickDP.Connector Library. | |
|
Binds to a database and provides database manipulation functions. Provides the ability to:
| |
|
| |
|
Represents a Pick dynamic array. | |
|
Provides information regarding the type of database server being used and server side date and time functions. | |
|
Contains information about each field in a record. It is obtained through a connRecord class. | |
|
Provides Pick utilities within the client's environment. | |
|
Represents a Pick item. | |
|
| |
|
Represents a Pick item. | |
|
Creates a record set. A record set is a collection of connRecord Objects that are traversed via a cursor. | |
|
Provides low-level data manipulation to a Pick file. | |
|
Creates a value-pair object where a unique name is assigned to a value. |