Direct Dbase III file access

back to main page

EZY Prolog -
direct access Dbase III files

Note:

Dbase III direct reading project has been ported to EZY Prolog and now is not available for download.

EZY Prolog provides much the most easy way of doing that task plus many more other benefits.

Please contact me directly via email if you are still interested in these sources.

This sample shows how Visual Prolog Studio objects can be used to access DBASE 3 files directly and explore them by use of various visual components.

The Dbase 3 sample project uses Catalog View Object and Grid Object for visual presentation of the database queries. Use init_dbase3_file predicate to initialize Dbase 3 Object.
 

Inlcude the following to your project:

class    dbase3_object
predicates
procedure    new(WINDOW,string FILENAME,FILE SYMBOLIC_FILE_NAME) - (i,i,i)
procedure    delete()
procedure    properties(INTEGER TotRecs,
                  SLIST FieldListUP,
                  FldDescL,
                  INTEGER DATASTART) - (o,o,o,o)
procedure    dbase3_row(INTEGER Row,CHAR Deleted,dBase3Rec Rec) - (i,i,o),(i,o,o)
procedure    open_dbase3()
procedure    close_dbase3()
procedure    dbase_catalog(STRING FileName,
            SLIST OldFieldList,
            STRING NODENAME,
            BROWSELIST_LIST) - (i,i,o,o)
procedure    set_row(INTEGER DataRow,CHAR) - (i,o)
procedure    row_data(STRING FIELD, STRING VALUE) - (i,o)
protected facts
determ    object_window(WINDOW)
determ    dbase3_file(STRING FILENAME,FILE SYMBOLIC_FILE_NAME)
determ    dbase_props(INTEGER TotRecs,
               SLIST FieldListUP,
               FldDescL,
               INTEGER DATASTART)
    db_record(INTEGER ROW,CHAR DELETED, dBase3Rec REC)
protected facts - current_record
determ    row_number(INTEGER)
determ    row_prefix(CHAR)
    fld(STRING FIELDNAME, STRING VALUE)   
endclass dbase3_object

The following code should be included on Windows create event:
win_catalog_object_sample_eh(_Win,e_Create(_),0):-
    SystemObject = system_object::new(_Win),
    store_grid_callback(_Win,my_grid_callback),
    init_dbase3_file(_Win,FileName),
    FieldList = [],
    filenamepath(FileName,_,ShortFile),
    format(Title,"Dbase III Catalog for %",ShortFile),
    win_SetText(_Win, Title),
    get_dbase3_object(_Win,Dbase3Object),
    Dbase3Object:dbase_catalog(FileName,FieldList,NODENAME,BROWSELIST_LIST),
    BROWSELIST_ITEM = bi(visited,NODENAME,
                    node(open,BROWSELIST_LIST),idi_computer),
    CATALOG_DATA = catalog_browsetree(BROWSELIST_ITEM,catalog_action_handler_my),
    TreeData = cast(long,CATALOG_DATA),
    SystemObject:save_object_ref("catalog_initial_data",TreeData),
    SystemObject:system_color("normal_background",color_blue),
   ............

The following predicate creates Dbase 3 Object:

init_dbase3_file(_Win,FileName):-
    FileName = dlg_GetFileName("*.dbf",["Dbase III Files","*.dbf"],"Open DBASE III Files",[],"",_OutListFiles),
    FileName <> "",
    % create Dbase3 object
    Dbase3Object = dbase3_object::new(_Win,Filename,dbase_file),
    !.


Copyright 1998-2000 EDMGROUP (Australia)

Last Updated: August 1, 2002