RDTA.PickDP.Connector Library Overview

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.

Key classes

Class

Description

connColumnDefinition

The definition of a column in a table or a record set.

connDatabase

Database or Pick account.

connField

Column of data from a connItem or connRecordSet.

connItem

Pick item.

connRecordSet

Record set created by querying a connDatabase. Used when accessing data in record sets.

connTable

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.

 

 

Example 1 below is an example of record at a time access.  Example 2 is an example of access through a record set.

Object Reference Model

 

Class Inheritance Model

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

 

Example1

The following subroutine:

Private Sub example1()

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

Example 2

Private Sub example2()

'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:

 

connColumnDefinition

Dictionary definition for a column.

connConstants

Defines the constants used by the RDTA.PickDP.Connector Library.

connDatabase

Binds to a database and provides database manipulation functions. Provides the ability to:

  • connect to a database.

  • access tables.

  • filter queries through select lists.

  • enable/disable debugging.

  • execute stored procedures.

  • switch databases.

connDetailSet

 

connDynamicArray

Represents a Pick dynamic array.

connEnvironment

Provides information regarding the type of database server being used and server side date and time functions.

connField

Contains information about each field in a record. It is obtained through a connRecord class.

connFunctions

Provides Pick utilities within the client's environment.

connItem

Represents a Pick item.

connkFields

 

connRecord

Represents a Pick item.

connRecordset

Creates a record set. A record set is a collection of connRecord Objects that are traversed via a cursor.

connTable

Provides low-level data manipulation to a Pick file.

connValuePair

Creates a value-pair object where a unique name is assigned to a value.

 

5