|
DSC Tech Library
WebAPI Web Access To Telemation
Visual Basic Descriptions and Declarations of WebAPI routines
WebAPISetHostName - Set the server host name. This, along with WebAPISetDBASE, should be called for initialization.
Private Declare Sub WebAPISetHostName Lib "WebAPI32.dll" _
(ByVal HostName As String)
Sample HostName - "appts.mydomain.com"
WebAPISetDBASE - Location of WebAPI Servers control data
Private Declare Sub WebAPISetDBASE Lib "WebAPI32.dll" _
(ByVal DbTree As String)
sample DbTree - "/src/appts/dbase"
WebAPIPingServer - Internal ping routine returns true/false. May be
used to verify simple communication.
Private Declare Function WebAPIPingServer Lib "WebAPI32.dll" _
(ByVal Message As String) As Boolean
Bounces "Message"
WebAPIValidateTMUser - Checks username and password to see if it
would be a valid Telemation login. Returns
true/false
Private Declare Function WebAPIValidateTMUser Lib "WebAPI32.dll" _
(ByVal User As String, _
ByVal Password As String) As Boolean
WebAPIFlushRefno - Releases all record buffers and associated memory
allocations on a given Refno ("reference
number"), leaving the search criteria intact.
Private Declare Sub WebAPIFlushRefno Lib "WebAPI32.dll"
(ByVal Refno As Long)
WebAPIFlushSearchRefno - Clears the current search critera on the
given Refno, leaving allocated record
memory for re-use.
Private Declare Sub WebAPIFlushSearchRefno Lib "WebAPI32.dll"
(ByVal Refno As Long)
WebAPIFlushAllRefno - Releases record buffers and clears search
criteria on a given Refno. (Combination of
WebAPIFlushRefno & WebAPIFlushSearchRefno).
Private Declare Sub WebAPIFlushAllRefno Lib "WebAPI32.dll"
(ByVal Refno As Long)
WebAPIFlushAll - Releases record buffers and clears search criteria
for all active Refnos.
Private Declare Sub WebAPIFlushAll Lib "WebAPI32.dll" ()
WebAPIDescribeFields - Given a valid File Definition name, this
routine returns the field names defined to the
file, and their lengths (all data returned as
character). Returns true if successful.
(ByVal FileName As String, _ File Definition Name
ByRef RecordBuffer As Byte, _ Return buffer in the format of:
: :,
e.g., "NAME:32 ADDRESS:16
PHONE:10"
ByVal MaxLength As Long)_ Maximum number of bytes to return.
As Long Return value can be:
WebAPI_SUCCESS
WebAPI_ERR_NOTLOGGEDIN
WebAPI_ERR_COMMUNICATION
WebAPI_ERR_NOTFOUND
Private Declare Function WebAPIDescribeFields Lib "WebAPI32.dll" _
(ByVal FileName As String, _
ByRef RecordBuffer As Byte, _
ByVal MaxLength As Long) As Long
WebAPISetSearch - This routine sets the search criteria for a new
Refno (returned). When accessing data, call this
routine (or WebAPISetSearchOn) to establish the
record set desired, call WebAPIReturnRecords, then
WebAPIReturnRecord iteratively to retrieve each
record of the set.
(ByVal FileName As String, _ File Definition Name - must have
at least this set for
WebAPIReturnRecords to work.
ByVal Field1 As String, _ Field Name on which to place a
search condition. If "NULL" or
Value1_1 is empty (""), then all
records are returned.
ByVal Value1_1 As String, _ Value agains which Operator1 is
applied. If this is empty ("") or
Field1 is "NULL", then all records
are returned.
ByVal Operator1 As Long, _ Boolean operator - 0 - Equals
1 - LT
2 - GT
3 - LE
4 - GE
5 - NE
6 – Range
ByVal Value1_2 As String, _ If Operator1 is 6 (Range), this is used as the high value. Ignored
for other boolean operators.
ByVal AndOrNull As Long, _ If this is non-zero then look at the next set of criteria:
0 - Ignore the rest of the arguments
1 - AND the criteria
1 - OR the criteria
ByVal Field2 As String, _ If AndOrNull is non-zero, these fields
ByVal Value2_1 As String, _ are used the same as the
ByVal Operator2 As Long, _ first set of search condition
ByVal Value2_2 As String) _ fields.
As Long Return value is the newly created Refno, used in data access and flushing routines.
Private Declare Function WebAPISetSearch Lib "WebAPI32.dll" _
(ByVal FileName As String, _
ByVal Field1 As String, _
ByVal Value1_1 As String, _
ByVal Operator1 As Long, _
ByVal Value1_2 As String, _
ByVal AndOrNull As Long, _
ByVal Field2 As String, _
ByVal Value2_1 As String, _
ByVal Operator2 As Long, _
ByVal Value2_2 As String) As Long
WebAPISetSearchOn - This routine sets the search criteria for a given Refno. If the Refno has already been created,
then this will set the search criteria - if an
arbitrary (uncreated) Refno is given, then a new
one will be created on with that Refno. When
accessing data, call this routine (or
WebAPISetSearch) to establish the record set
desired, call WebAPIReturnRecords, then
WebAPIReturnRecord iteratively to retrieve each
record of the set. See WebAPISetSearch() for
argument descriptions.
Private Declare Function WebAPISetSearchOn Lib "WebAPI32.dll" _
(ByVal Refno As Long, _
ByVal FileName As String, _
ByVal Field1 As String, _
ByVal Value1_1 As String, _
ByVal Operator1 As Long, _
ByVal Value1_2 As String, _
ByVal AndOrNull As Long, _
ByVal Field2 As String, _
ByVal Value2_1 As String, _
ByVal Operator2 As Long, _
ByVal Value2_2 As String) As Long
WebAPIReturnRecords - After calling WebAPISetSearch/
WebAPISetSearchOn, this routine will actually
submit the data request to the host and return
the records into a set, defined by Refno.
FieldList is used to establish which defined
fields (see WebAPIDescribeFields) you wish to
have returned, thus describing the returned
record layout. The created record length is
also returned.
(ByVal Refno As Long, _ Supplied reference number
constant.
ByVal FieldList As String, _ List of Field Names, comma-
delimited, which you wish
returned for each record, e.g,
"NAME,ADDRESS,PHONE"
ByRef RecordLength As Long) _ Returned record length
resulting from FieldLists
description.
As Long Returns number of records found
and in the Refno record set, or
error:
WebAPI_ERR_NOTLOGGEDIN
WebAPI_ERR_COMMUNICATION
WebAPI_ERR_SEARCHCRITERIA (no
search criteria established)
WebAPI_ERR_NOTFOUND (File
Definition, supplied by
WebAPISetSearch[On], not
found.
Private Declare Function WebAPIReturnRecords Lib "WebAPI32.dll" _
(ByVal Refno As Long, _
ByVal fieldList As String, _
ByRef recordLength As Long) As Long
WebAPIReturnRecord - After calling WebAPIReturnRecords, this will
retrieve each record based on WhichRecord.
FieldList is used to request which fields of the
returned set the user wishes – this is
necessarily a subset of the FieldList provided
in WebAPIReturnRecords. Returns false if Refno
is bad or WhichRecord is out of range.
(ByVal Refno As Long, _ Supplied reference number
constant.
ByVal WhichRecord As Long, _ Which record of the set to
return (0-based).
ByVal FieldList As String, _ List of Field Names, comma-
delimited, which you wish
returned for each record. This
defines the returned record
layout, with the character data
for each field concatenated in
the order in which this list is
supplied, e.g,
"NAME,ADDRESS,PHONE"
ByRef RecordBuffer As Byte, _ Buffer in which data is to be
returned. Should be large
enough for FieldLists
definition, but can be
restrained with MaxLength.
ByRef Recno As Long, _ Returned Recno (record
identifier used for changes,
etc.)
ByVal MaxLength As Long) _ Maximum number of bytes per
record to return.
As Boolean Returns false if WhichRecord is
out of range.
Private Declare Function WebAPIReturnRecord Lib "WebAPI32.dll" _
(ByVal Refno As Long, _
ByVal WhichRecord As Long, _
ByVal fieldList As String, _
ByRef RecordBuffer As Byte, _
ByRef Recno As Long, _
ByVal MaxLength As Long) As Boolean
WebAPIChangeRecord - Changes, on the server database, the data in a
record on an existing reference number by
position in the set (WhichRecord). FieldList is
used to request which fields of the record the
user wishes to modify. Unspecified fields are
not touched.
(ByVal Refno As Long, _ Supplied reference number
constant.
ByVal WhichRecord As Long, _ Which record of the set to
change (0-based).
ByVal FieldList As String, _ List of Field Names, comma-
delimited, which you wish
changed in the record. This
defines the provided record
layout, with the character data
for each field concatenated in
the order in which this list is
supplied, e.g,
"NAME,ADDRESS,PHONE"
Data in the remainder of the
record remains untouched.
ByVal RecordBuffer As String) Buffer in which changed record
data is supplied. Should match
in length FieldLists
definition.
As Long Return value can be:
WebAPI_SUCCESS
WebAPI_ERROR
WebAPI_ERR_NOTLOGGEDIN
WebAPI_ERR_COMMUNICATION
WebAPI_ERR_SEARCHCRITERIA
WebAPI_ERR_NOTFOUND
WebAPI_ERR_LOCK
WebAPI_ERROR
Private Declare Function WebAPIChangeRecord Lib "WebAPI32.dll" _
(ByVal Refno As Long, _
ByVal WhichRecord As Long, _
ByVal fieldList As String, _
ByVal RecordBuffer As String) As Long
WebAPIChangeRecno - Changes, on the server database, the data in a
record on an existing reference number by
Recno (as returned by WebAPIReturnRecord).
FieldList is used to request which fields of the
record the user wishes to modify. Unspecified
fields are not touched. Arguments are identical
those in WebAPIChangeRecord(), except the second
argument is interpreted as a Recno, rather than
a 0-based offset into a record set. Useful for
making changes to known records from flushed data
sets.
Private Declare Function WebAPIChangeRecno Lib "WebAPI32.dll" _
(ByVal Refno As Long, _
ByVal Recno As Long, _
ByVal fieldList As String, _
ByVal RecordBuffer As String) As Long
WebAPIDeleteRecord - Deletes, on the server database, a record in an
existing reference number by position in the set
(WhichRecord).
(ByVal Refno As Long, _ Supplied reference number
constant.
ByVal WhichRecord As Long) Which record of the set to
delete (0-based).
As Long Return value can be:
WebAPI_SUCCESS
WebAPI_ERROR
WebAPI_ERR_NOTLOGGEDIN
WebAPI_ERR_COMMUNICATION
WebAPI_ERR_SEARCHCRITERIA
WebAPI_ERR_NOTFOUND
WebAPI_ERROR
Private Declare Function WebAPIDeleteRecord Lib "WebAPI32.dll" _
(ByVal Refno As Long, _
ByVal WhichRecord As Long) As Long
WebAPIDeleteRecno - Deletes, on the server database, a record in an
existing reference number by Recno (as returned
by WebAPIReturnRecord).
(ByVal Refno As Long, _ Supplied reference number
constant.
ByVal Recno As Long) Recno as returned from
WebAPIReturnRecord.
As Long Return value can be:
WebAPI_SUCCESS
WebAPI_ERROR
WebAPI_ERR_NOTLOGGEDIN
WebAPI_ERR_COMMUNICATION
WebAPI_ERR_SEARCHCRITERIA
WebAPI_ERR_NOTFOUND
Private Declare Function WebAPIDeleteRecno Lib "WebAPI32.dll" _
(ByVal Refno As Long, _
ByVal Recno As Long) As Long
WebAPIAddRecord - Adds a record on the server database. FieldList is
used to request which fields of the record the user
wishes to initialize. Unspecified fields are
initialized to spaces & nulls where appropriate.
(ByVal FileName As String, _ File Definition name.
ByVal FieldList As String, _ List of Field Names, comma-
delimited, which you wish
initialized in the record.
This defines the provided
record layout, with the
character data for each field
concatenated in the order in
which this list is supplied,
e.g, "NAME,ADDRESS,PHONE"
Data in the remainder of the
record is appropriately
initialized before the add.
ByVal RecordBuffer As String) Buffer in which record
data is supplied. Should match
in length FieldLists
definition.
As Long Recno, or:
WebAPI_ERROR
WebAPI_ERR_NOTLOGGEDIN
WebAPI_ERR_COMMUNICATION
WebAPI_ERR_NOTFOUND
Private Declare Function WebAPIAddRecord Lib "WebAPI32.dll" _
(ByVal FileName As String, _
ByVal fieldList As String, _
ByVal RecordBuffer As String) As Long
|