BBjRecordSet

Description

In BBj 4.0 and higher, a BBjRecordSet represents the set of records from a data file or SQL SELECT command. The BBjRecordSet maintains a pointer to the current record (BBjRecordData) with methods to insert, update, delete, and move between records. A record set is often bound to one or more data-aware GUI controls. See Interface RecordSetBindable::bindRecordSet for more information.

Creation

BBjAPI > BBjRecordSet

BBjSysGui > BBjRecordSet

The BBjRecordSet object is created through the following BBjAPI object methods:

Return Value

Method

BBjRecordSet

createFileRecordSet(string filename, string modes, string template)

BBjRecordSet

createMemoryRecordSet(string stringTemplate)

BBjRecordSet

createSQLRecordSet(string connect, string modes, string select)

BBjRecordSet

createSQLRecordSet(string  connect , string modes, string select, boolean scrollSensitive)

BBjRecordSet

createSQLRecordSet(string connect, string modes, string select, boolean scrollSensitive, boolean updatable)

A resource-based BBjRecordSet is created through the following BBjSysGui object method:

Return Value Method
BBjRecordSet createRecordSet(int resHandle, int recordSetID)

Methods of BBjRecordSet

Return Value

Method

void

addMapping(string diskField, string presentationField, BBjMappingSource valueSource, BBjMappingAction action)

void

close()

BBjMappingSource

createEmptyMappingSource()

BBjMappingAction

createErrorMappingAction()

BBjFormatMappingAction

createFormatMappingAction(string format)

BBjRecordSetMappingSource

createRecordSetMappingSource(BBjRecordSet valueSource, string backField, string frontField)

void

deleteCurrentRecordData()

void

first()

String

getConnectString()

BBjRecordData

getCurrentRecordData()

int getCurrentRecordNumber()

BBjRecordData

getEmptyRecordData()

String

getFileName()

java.sql.ResultSet

getJDBCResultSet()

BBjMappingDescription

getMappingDescription()

String

getMode()

String

getQuery()

int

getRecordCount()

BBjRecordData

getSourceRecordData()

String

getTemplate()

void

insert(BBjRecordData recordData)

boolean

isCurrentRecordDirty()

boolean

isEmpty()

boolean

isScrollSensitive()

boolean

isUpdatable()

void

last()

int

move(int count)

void

moveToRecord(int recordNumber)

void

next()

void

previous()

void

seek(BBjRecordData recordData)

seek(BBjRecordData recordData, boolean partial)

void

seekBackward(BBjRecordData recordData)

seekBackward(BBjRecordData recordData, boolean partial)

void

seekForward(BBjRecordData recordData)

seekForward(BBjRecordData recordData, boolean partial)

void

setCurrentRecordData(BBjRecordData recordData)

void

update(BBjRecordData recordData)

Remarks

None.

Constants

None.

Example

rem ' BBjRecordSet Sample

rem ' BBjRecordSet sample
rem ' First, create a data file
FILENAME$="BBjRecordSet.dat"
MODES$=""
TEMPLATE$="STATE:C(2),NAME:C(16*=)"
erase FILENAME$,err=*next
mkeyed FILENAME$,2,0,32
channel=unt
open (channel)FILENAME$
dim REC$:TEMPLATE$

rem ' Load the file with state codes and names
while 1
    dread rec.state$,rec.name$,END=*break
    write record (channel,KEY=rec.state$)rec$
wend
close (channel)

rem ' Create the RecordSet
RecordSet! = BBJAPI().createFileRecordSet(FILENAME$,MODES$,TEMPLATE$)

rem ' Go to the first record
RecordSet!.first()

rem ' Retrieve the RecordData for the current record
RecordData! = RecordSet!.getCurrentRecordData()

rem ' Print the RecordData
print "The first record is:",'LF',RecordData!,

stop

DATA "AK","Alaska"
DATA "AL","Alabama"
DATA "AR","Arkansas"
DATA "AZ","Arizona"
DATA "CA","California"
DATA "CO","Colorado"
DATA "CT","Connecticut"
DATA "DC","District of Columbia"
DATA "DE","Delaware"
DATA "FL","Florida"
DATA "GA","Georgia"
DATA "GU","Guam"
DATA "HI","Hawaii"
DATA "IA","Iowa"
DATA "ID","Idaho"
DATA "IL","Illinois"
DATA "IN","Indiana"
DATA "KS","Kansas"
DATA "KY","Kentucky"
DATA "LA","Louisiana"
DATA "MA","Massachusetts"
DATA "MD","Maryland"
DATA "ME","Maine"
DATA "MI","Michigan"
DATA "MN","Minnesota"
DATA "MO","Missouri"
DATA "MS","Mississippi"
DATA "MT","Montana"
DATA "NC","North Carolina"
DATA "ND","North Dakota"
DATA "NE","Nebraska"
DATA "NH","New Hampshire"
DATA "NJ","New Jersey"
DATA "NM","New Mexico"
DATA "NV","Nevada"
DATA "NY","New York"
DATA "OH","Ohio"
DATA "OK","Oklahoma"
DATA "OR","Oregon"
DATA "PA","Pennsylvania"
DATA "PR","Puerto Rico"
DATA "RI","Rhode Island"
DATA "SC","South Carolina"
DATA "SD","South Dakota"
DATA "TN","Tennessee"
DATA "TX","Texas"
DATA "UT","Utah"
DATA "VA","Virginia"
DATA "VI","Virgin Islands"
DATA "VT","Vermont"
DATA "WA","Washington"
DATA "WI","Wisconsin"
DATA "WV","West Virginia"
DATA "WY","Wyoming"

See Also

BBjAPI

BBjNavigator

BBj Object Variables

BBj Object Assignment

BBj Object Error Handling

BBj Object Operators

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.