xBaseJ.Client
Class DBF

java.lang.Object
  |
  +--xBaseJ.Client.DBF

public class DBF
extends java.lang.Object


Constructor Summary
DBF(java.lang.String inDBFname, java.lang.String inhost, int inport)
          opens a DBF at the server
 
Method Summary
 void close()
          closes the database NOT FULLY IMPLEMENTED
 void delete()
          marks the current records as deleted
 boolean deleted()
           
 boolean find(java.lang.String keyString)
          used to find a record with an equal or greater string value when done the record pointer and field contents will be changed
 void findNext()
          used to get the next record in the Index list when done the record pointer and field contents will be changed
 void findPrev()
          used to get the previous record in the Index list when done the record pointer and field contents will be changed
 int fldcount()
          Deprecated. use getFieldCount
 int getCurrentRecordNumber()
           
 Field getField(int i)
           
 Field getField(java.lang.String name)
           
 int getFieldCount()
           
 java.lang.String getName()
           
 int getRecordCount()
           
 void gotoRecord(long recno)
          used to read a record at a particular place in the database when done the record pointer and field contents will be changed
 void read()
          used to read the next record, after the current record pointer, in the database when done the record pointer and field contents will be changed
 void readPrev()
          used to read the previous record, before the current record pointer, in the database when done the record pointer and field contents will be changed
 int reccount()
          Deprecated. use getRecordCount
 int recno()
          Deprecated. use getCurrentRecordNumber
 void setLock(boolean lockSwitch)
          locks/unlocks the whole table
 void setRecordLock(boolean lockSwitch)
          locks/unlocks the current record.
 void undelete()
          marks the current records as not deleted
 void update()
          updates the record at the current position
 void useIndex(java.lang.String name)
          opens an index associated with the database
 void useTag(java.lang.String name)
          assigns Tag associated with the database used in find, findnext and findprev
Tags are not defined in the dbfs.dbf file
 void write()
          used to write a new record in the database when done the record pointer is at the end of the database
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBF

public DBF(java.lang.String inDBFname,
           java.lang.String inhost,
           int inport)
    throws xBaseJException,
           java.io.IOException,
           java.net.UnknownHostException
opens a DBF at the server
Parameters:
DBFname - database as defined on the server
inhost - host name or ip address
inport - host listening port
Throws:
xBaseJException - File does exist and told not to destroy it.
xBaseJException - Told to destroy but operating system can not destroy
java.io.IOException - Java error caused by called methods
java.lang.SecurityException - Java error caused by called methods, most likely trying to create on a remote system
Method Detail

setLock

public void setLock(boolean lockSwitch)
             throws xBaseJException,
                    java.io.IOException
locks/unlocks the whole table
Parameters:
lockSwitch - - true - lock the table, false - unlock
Throws:
xBaseJException - most likely table already locked by another process
java.io.IOException - Java error caused by called methods

setRecordLock

public void setRecordLock(boolean lockSwitch)
                   throws xBaseJException,
                          java.io.IOException
locks/unlocks the current record. You must read, write or find the record before locking
Parameters:
lockSwitch - - true - lock the record, false - unlock
Throws:
xBaseJException - most likely table or record is already locked by another process record cursor not on a valid record - read a record first
java.io.IOException - Java error caused by called methods

useIndex

public void useIndex(java.lang.String name)
              throws xBaseJException,
                     java.io.IOException
opens an index associated with the database
Parameters:
indexname - an existing index as defined in Server's dbfs.dbf
Throws:
xBaseJException - xBaseJ Fields defined in Index do not match Fields in database
java.io.IOException - Java error caused by called methods

useTag

public void useTag(java.lang.String name)
            throws xBaseJException,
                   java.io.IOException
assigns Tag associated with the database used in find, findnext and findprev
Tags are not defined in the dbfs.dbf file
Parameters:
Tag - as defined in the MDX File.
Throws:
xBaseJException - xBaseJ Fields defined in Index do not match Fields in database
java.io.IOException - Java error caused by called methods

find

public boolean find(java.lang.String keyString)
             throws xBaseJException,
                    java.io.IOException
used to find a record with an equal or greater string value when done the record pointer and field contents will be changed
Parameters:
keyString - a search string
Returns:
boolean - true if record found key matches input key
Throws:
xBaseJException - xBaseJ no Indexes/Tags opened with database
java.io.IOException - Java error caused by called methods

findNext

public void findNext()
              throws xBaseJException,
                     java.io.IOException
used to get the next record in the Index list when done the record pointer and field contents will be changed
Throws:
xBaseJException - xBaseJ Index/Tag not opened or not part of the database
java.io.IOException - Java error caused by called methods

findPrev

public void findPrev()
              throws xBaseJException,
                     java.io.IOException
used to get the previous record in the Index list when done the record pointer and field contents will be changed
Throws:
xBaseJException - xBaseJ Index/Tag not opened or not part of the database
java.io.IOException - Java error caused by called methods

fldcount

public int fldcount()
Deprecated. use getFieldCount

Returns:
int the number of Fields in a database

recno

public int recno()
Deprecated. use getCurrentRecordNumber

Returns:
int the current record number

reccount

public int reccount()
             throws xBaseJException,
                    java.io.IOException
Deprecated. use getRecordCount

Returns:
int the number of records in a database
Throws:
xBaseJException - logic error with server
java.io.IOException - logic error with server

getFieldCount

public int getFieldCount()
Returns:
int the number of Fields in a database

getCurrentRecordNumber

public int getCurrentRecordNumber()
Returns:
int the current record number

getRecordCount

public int getRecordCount()
                   throws xBaseJException,
                          java.io.IOException
Returns:
int the number of records in a database
Throws:
xBaseJException - logic error with server
java.io.IOException - logic error with server

read

public void read()
          throws xBaseJException,
                 java.io.IOException
used to read the next record, after the current record pointer, in the database when done the record pointer and field contents will be changed
Throws:
xBaseJException - usually the end of file condition
java.io.IOException - Java error caused by called methods

readPrev

public void readPrev()
              throws xBaseJException,
                     java.io.IOException
used to read the previous record, before the current record pointer, in the database when done the record pointer and field contents will be changed
Throws:
xBaseJException - usually the top of file condition
java.io.IOException - Java error caused by called methods

gotoRecord

public void gotoRecord(long recno)
                throws xBaseJException,
                       java.io.IOException
used to read a record at a particular place in the database when done the record pointer and field contents will be changed
Parameters:
recno - the relative position of the record to read
Throws:
xBaseJException - passed an negative number, 0 or value greater than the number of records in database
java.io.IOException - Java error caused by called methods

write

public void write()
           throws xBaseJException,
                  java.io.IOException
used to write a new record in the database when done the record pointer is at the end of the database
Throws:
xBaseJException - any one of several errors
java.io.IOException - Java error caused by called methods

update

public void update()
            throws xBaseJException,
                   java.io.IOException
updates the record at the current position
Throws:
xBaseJException - any one of several errors
java.io.IOException - Java error caused by called methods

delete

public void delete()
            throws java.io.IOException,
                   xBaseJException
marks the current records as deleted
Throws:
xBaseJException - usually occurs when no record has been read
java.io.IOException - Java error caused by called methods

undelete

public void undelete()
              throws java.io.IOException,
                     xBaseJException
marks the current records as not deleted
Throws:
xBaseJException - usually occurs when no record has been read.
java.io.IOException - Java error caused by called methods

close

public void close()
           throws java.io.IOException,
                  xBaseJException
closes the database NOT FULLY IMPLEMENTED
Throws:
java.io.IOException - Java error caused by called methods
xBaseJException - logic error with server

getField

public Field getField(int i)
               throws java.lang.ArrayIndexOutOfBoundsException,
                      xBaseJException
Parameters:
i - Field number
Returns:
Field object by its relative position
Throws:
xBaseJException - usually occurs when Field number is less than 1 or greater than the number of Fields
java.lang.ArrayIndexOutOfBoundsException - Java error caused by called methods

getField

public Field getField(java.lang.String name)
               throws xBaseJException,
                      java.lang.ArrayIndexOutOfBoundsException
Parameters:
name - Field name
Returns:
Field object by its name in the database
Throws:
xBaseJException - Field name is not correct
java.lang.ArrayIndexOutOfBoundsException - Java error caused by called methods

getName

public java.lang.String getName()
Returns:
String operating system name of the database

deleted

public boolean deleted()
                throws java.io.IOException,
                       xBaseJException
Returns:
boolean true if record is marked for deletion
Throws:
xBaseJException - logic error with server
java.io.IOException - logic error with server