home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / DBAPI.ZIP / MANUAL < prev    next >
Encoding:
Text File  |  1997-04-25  |  3.8 KB  |  172 lines

  1. NAME
  2.     dbaddfld
  3.  
  4. SYNOPSIS
  5.     #include "dbapi.h"
  6.  
  7.     DBFFIELD *dbaddfld(DBFFIELD *base,char *name,
  8.             int type,word len,int dec)
  9.  
  10. DESCRIPTION
  11.     dbaddfld adds an entry into field list which can be used
  12.     to create dbase file. base is a pointer to first entry in
  13.     list, name is field name (max 10 chars) type is field type
  14.     identifier ( 'C','N','L','D' or 'M') len is a field length
  15.     and dec is number of decimal places for 'N' type.
  16.     the field definitions will be used for newly created
  17.     dbase file and will be automatically disposed when the
  18.     file is closed.
  19.  
  20. DIAGNOSTICS
  21.     returns pointer to newly created field definition if successful
  22.     or NULL if runs out of memory (already existing entries, if any,
  23.     are _not_ disposed)
  24.  
  25. EXAMPLE
  26.     #include "dbapi.h"
  27.  
  28.     DBFFILE *createxxx(void)
  29.     {
  30.     DBFFILE *dbf=NULL;
  31.     DBFFIELD *nfd;
  32.         nfd=dbaddfld(NULL,"ACCOUNT",'C',6,0);
  33.         if (nfd) {
  34.             dbaddfld(nfd,"CLIENT",'C',52,0);
  35.             dbaddfld(nfd,"PHONE",'C',20,0);
  36.             dbaddfld(nfd,"REGNUM",'C',11,0);
  37.             unlink("CLIENTS.DBF");
  38.             dbf=dbfcreate("CLIENTS.DBF",3,nfd);
  39.         }
  40.         return dbf;
  41.     }
  42.     
  43. SEE ALSO
  44.     dbfcreate
  45. NAME
  46.     dbkillflds
  47.  
  48. SYNOPSIS
  49.     #include "dbapi.h"
  50.  
  51.     void dbkillflds(DBFFIELD *f)
  52.  
  53. DESCRIPTION
  54.     disposes the whole field list built with dbaddfld. normally
  55.     not needed as dbfclose disposes the list automatically but
  56.     could be used if dbaddfld fails.
  57.  
  58. SEE ALSO
  59.     dbaddfld
  60.  
  61. NAME
  62.     dbfclose
  63.  
  64. SYNOPSIS
  65.     #include "dbapi.h"
  66.  
  67.     void dbfclose(DBFFILE *dbf)
  68.  
  69. DESCRIPTION
  70.     closes dbase opened with dbfopen or created with dbfcreate.
  71.     if dbfwrite has been used on the dbase then file header is
  72.     updated as well.
  73. NAME
  74.     dbfcreate
  75.  
  76. SYNOPSIS
  77.     #include "dbapi.h"
  78.  
  79.     DBFFILE *dbfcreate(char *fn,int ver,DBFFIELD *fields)
  80.  
  81. DESCRIPTION
  82.     dbfcreate creates a new dbase file. fn is a file name for
  83.     database and ver is version number (2 or 3 are supported
  84.     at the moment). fields is a list of field definitions
  85.     built with dbaddfld.
  86.  
  87. DIAGNOSTICS
  88.     dbfcreate will return opened dbase file pointer to newly
  89.     created file if successful or NULL when create fails or
  90.     the file already exists. In case of failure the field list 
  91.     is disposed and becomes invalid.
  92.  
  93. SEE ALSO
  94.     dbaddfld
  95. NAME
  96.     dbfopen
  97.  
  98. SYNOPSIS
  99.     #include "dbapi.h"
  100.  
  101.     DBFFILE *dbfopen(char *fn)
  102.  
  103. DESCRIPTION
  104.     dbfopen opens an existing dbase file, automatically handling
  105.     both version2 and version3 files.
  106.  
  107. DIAGNOSTICS
  108.     pointer to opened file is returned if everything's ok, NULL
  109.     if something goes wrong.
  110. NAME
  111.     dbread
  112.  
  113. SYNOPSIS
  114.     #include "dbapi.h"
  115.  
  116.     char *dbread(char *buf,dword recno,DBFFILE *dbf)
  117.  
  118. DESCRIPTION
  119.     dbread reads a single record from dbase into buf. the record
  120.     length is taken from file record, recno is 0-based, so the
  121.     first record in the file is #0, second is #1 and so on.
  122.  
  123. DIAGNOSTICS
  124.     returns buf if successful, NULL if fails.
  125. NAME
  126.     dbwrite
  127.  
  128. SYNOPSIS
  129.     #include "dbapi.h"
  130.  
  131.     char *dbwrite(char *buf,dword recno,DBFFILE *dbf)
  132.  
  133. DESCRIPTION
  134.     dbwrite writes a single record into file at specified record
  135.     position. first record is 0.
  136.  
  137. DIAGNOSTICS
  138.     returns buf if OK, NULL if fails.
  139. NAME
  140.     fpmemoopen - open a foxpro memo file
  141.  
  142. SYNOPSIS
  143.     #include "dbapi.h"
  144.  
  145.     FPMEMOFILE *fpmemoopen(char *fn);
  146.  
  147. DESCRIPTION
  148.     opens a foxpro memo file for read/write and retrieves a block
  149.     size for later offset calculations.
  150. NAME
  151.     fpmemoclose - close memo file
  152.  
  153. SYNOPSIS
  154.     #include "dbapi.h"
  155.  
  156.     void fpmemoclose(FPMEMOFILE *mf);
  157.  
  158. DESCRIPTION
  159.     closes a memo file
  160. NAME
  161.     fpmemofindblock - seet to beginning of the memo data in memo file
  162.  
  163. SYNOPSIS
  164.     #include "dbapi.h"
  165.  
  166.     long fpmemofindblock(FPMEMOFILE *mf,long blockno);
  167.  
  168. DESCRIPTION
  169.     this function seeks to the given memo block number in memo file
  170.     and returns length of the memo data in bytes. file data pointer
  171.     will be at the beginning of memo data.
  172.