Table of Contents

Navigation: »No topics above this level«

Return to chapter overview

Table of Contents

Mainkp1yck

Overview conj37qwe

Contacting Wilson WindowWareIDH7wsxin

How to get Technical Supportconcjaqwe

About this Help Filecon.jbqwe

Notational Conventionslv1yck

Complete Function Listcon..fqwe

LAFFDB Error Stringsjxgyck

dbBindColInd8j2.99

dbCloneRecordbp1y0q

dbClosebp1ycl

dbCookDatabasesInd8j2.91

dbDebugbp1y0s

dbDeleteColumnInd8j2.92

dbDeleteRecordbp1y0p

dbExistbp1y.k

dbFindRecordID__tq4np

dbGetColumnCountbp1yco

dbGetColumnNamebp1ycm

dbGetColumnNumberbp1y.l

dbGetColumnTypebp1ycn

dbGetEntireRecordbp1y0n

dbGetLastErrorbp1ycr

dbGetNextItembp1y0t

dbGetRecordCountbp1y0r

dbGetRecordFieldbp1y0m

dbGetSaveStatusbp1y.t

dbGetVersionInd8j2.96

dbInsertColumnInd8j2.93

dbMakeNewItembp1y0k

dbNameColumnbp1ycq

dbOpenbp1yck

dbSavebp1ycp

dbSetDelimiterInd8j2.95

dbSetOptionsInd8j2.98

dbSetRecordFieldbp1y0l

dbSetEntireRecordbp1y0o

dbSortbp1ycs

dbSwapColumnsInd8j2.94

dbSetErrorReportingInd8j2.97

Sample DatabaseIDHgd9xin


MAIN

Overview of LAFFDB Extenderconj37qwe

Complete Function Listcon..fqwe

LAFFDB Error Stringsjxgyck

Sample DatabaseIDHgd9xin

Notational Conventionslv1yck

Contacting Wilson WindowWareIDH7wsxin

How to get Technical Supportconcjaqwe

About this Help Filecon.jbqwe

LAFFDB Extender

The (LAFFDB) Light ASCII Flat File DataBase Extender is a Windows Interface Language (WIL) Extender that is designed to support a simple multicolumn database.

Each function has a complete running example to show its usage.

Note: This extender is intended for single user access databases.

Requirements:Windows 95/98/ME, Windows NT/2000/XP


Overview

Overview of LAFFDB Extender

The (LAFFDB) Light ASCII Flat File DataBase Extender is a Windows Interface Language (WIL) Extender that is designed to support a simple multicolumn database.

LAFFDB Extender DLL Name: LAFFD34i.DLL

Each function has a complete running example to show its usage.

LAFFDB is a Windows Interface Language (WIL) Extender that is designed to support a simple multicolumn database. The database storage medium can be of three different models:• 0 - Disk-based. In this type of database, any changes to the database are immediately reflected on the disk file. Ideal for instant editing of files.

• 1 - Memory-based. In this type of database, no disk functions are used. This is ideal for implementing temporary databases as well as simulating a record-based data structure in WinBatch.

• 2 - Traditional. This database is loaded from disk, manipulated in memory, and saved back to disk upon program request.The file format of LAFFDB is text-based, with one row of data per LF terminated line. CR's are stripped from the file and ignored. (When writing the file to disk, each record will be written terminated by a CRLF). Each column of information must be separated by one of the following mechanisms:

Ÿ Mainkp1yckŸ Complete Function Listcon..fqwe

A single character separator, such as a tab or a comma. Fields containing the character
separator must use quote marks to indicate a single field. Any field may be delimited by
quotemarks. All leading and trailing quote marks of any field are stripped. Quotes within a
field are represented by two ajoining quotes

Example:

123,John Doe,Bellevue 12d,"Flintstone,
Fred",45,"1,000.00","GratuitiousQuotesAreLegal"

A space or multiple spaces. Text fields with multiple words must use quote marks to
indicate a single column. Quotes within a field are represented by two ajoining quotes

Example:

123 “John Doe”   Bellevue "Yes ""She said"""

Fixed column boundaries.

Example:

01234567890123456789012345678901
123 John Doe            Bellevue
232 Morrie Wilson       Seattle

The data types supported by LAFFDB are:

Text

Integer

Floating Point

LAFFDB will support sorting of the data across any column, in ascending or descending order. In addition, when two comparison fields are identical, their original order is retained so that successive sorts on more than one column would preserve the sort order of previous sorts where applicable.

Each column in LAFFDB can be addressed by a numerical identifier (Column 1, Column 2, etc), or can be assigned a textual name by the program (i.e. Column “Name”, Column “City”). LAFFDB can be instructed to use the first line of the text file to name the columns. For example, consider the following text file:

Name,Phone,City

Elmer Fudd,206-555-1212,Seattle

Bill Gates,425-882-8080,Redmond

If instructed, LAFFDB would load two records into the database (Elmer and Bill), and the three columns of data would be automatically labeled “Name”, “Phone”, and “City”.

LAFFDB supports addition, deletion, duplication, and modification of data items. Sorting maybe done manually after these operations if desired.

Each item in LAFFDB is accessible by two types of record numbers: Fixed and Variable. LAFFDB will generate these record numbers automatically.

The Fixed record number is a value that is used for a record in the database, and it will not change, even after a resort. This record number should be used if the program plans to hang onto the record number for a duration longer than the scope of the calling procedure. Fixed record numbers are not available for disk-based models.

The Variable record number is simply the index of the item in the array; it could change after any sort. This record number is useful when the program wishes to enumerate the database in sorted order; the code would simply use a FOR loop from 1 to the number of items in the list.

Note:

Whenever you are going to do an operation on the entire database, such as search or iterate, you should consider using variable record numbers, starting at 0. For example, if you have a database with 10 records, iterate from 0-9. This way you will get the records returned to you in the sort order you expect. Also, variable record numbers always start at 0 and go sequentially. Fixed record numbers can have gaps as records are deleted, and that puts the software into quite a quandary.

Fixed record numbers are handy when you want to access a particular record, and hang onto it for a duration of time where the record ordering of database could be modified. For example, if you want to call dbSortbp1ycs, dbDeleteRecordbp1y0p, dbCloneRecordbp1y0q, etc BETWEEN a dbGetEntireRecordbp1y0n and dbSetEntireRecordbp1y0o, then you would want to use a fixed record number so that you can be assured that the same database record is set as the one you get.


Contacting Wilson WindowWare

Wilson WindowWare, Inc.

5421 California Ave. SW

Seattle, WA 98136 USA

Orders: (800) 762-8383

Voice: (206) 938-1740

Fax: (206) 935-7129

Email: info@windowware.com

Registered users of our software receive manuals, technical support, use of Wilson WindowWare on-line information services, and special offers on new versions of Wilson WindowWare software products.

Ÿ Mainkp1yckŸ Complete Function Listcon..fqweŸ How to Get Technical Supportconcjaqwe


How to get Technical Support

The Wilson WindowWare web site is an excellent technical resource. Access to the entire Technical Support Database is at your fingertips. In the Technical Support area, use the keyword search to find answers to common problems, alternate scripting methods, and sample code. Or join the Wilson WindowWare Web BBS, a new Web forum. The BBS provides an outlet for registered users to share their experiences with other users.

See the information on registering a copy (found in the WinBatch.hlp file).The latest versions of our software are available on-line. The places here may change at any time -- check the installation sheet for the most recent addresses.Internet Web page: http://www.windowware.com

Internet Technical Support Articles & Web BBS: http://techsupt.windowware.com

http://webboard.windowware.com

Internet FTP: ftp.windowware.com in /wwwftp

Ÿ Mainkp1yckŸ Contacting Wilson WindowWareIDH7wsxinŸ Complete Function Listcon..fqwe


About this Help File

This extender adds extended capability to the Windows Interface Language (WIL) processing engine. Please refer to the WIL Reference Manual for an introduction to WIL, as well as for complete documentation of the many functions available in WIL and the programs that use it. This help file includes only topics and functions which are exclusive to this particular WIL Extender.

Ÿ Mainkp1yck

Ÿ Complete Function Listcon..fqweŸ Contacting Wilson WindowwareIDH7wsxin

Ÿ How to get Technical Supportconcjaqwe


Notational Conventions

Throughout this manual, we use the following conventions to distinguish elements of text:ALL-CAPSUsed for filenames.BoldfaceUsed for important points, programs, function names, and parts of syntax that must appear as shown.systemUsed for items in menus and dialogs, as they appear to the user.Small fixed-widthUsed for WIL sample code.ItalicsUsed for emphasis, and to liven up the documentation just a bit.

Ÿ Mainkp1yckŸ Complete Function Listcon..fqweŸ Contacting Wilson WindowwareIDH7wsxin

Ÿ How to get Technical Supportconcjaqwe

Acknowledgments

This extender developed by Dave Edson.

Documentation written by Dave Edson, Morrie Wilson and Deana Dahley.


Complete Function List

Database FunctionsdbBindColInd8j2.99Binds a column in a result set to a WIL variable

dbCloneRecordbp1y0qClones a record in the database

dbClosebp1yclCloses a database, frees the handle

dbCookDatabasesInd8j2.91Performs a varierty of operations on one or two databases.

dbDeleteColumnInd8j2.92Deletes columns

dbDeleteRecordbp1y0pDeletes a record from the databasedbExistbp1y.kCheck if database handle is valid.

dbFindRecordID__tq4npFinds the next record matching the Find string

dbGetColumnCountbp1ycoReturns the number of columns in the database

dbGetColumnNamebp1ycmReturns the name of the columndbGetColumnNumberbp1y.lReturns the integer column number of a named column, given the name.

dbGetColumnTypebp1ycnReturns the data type of a column

dbGetEntireRecordbp1y0nRetrieves all columns of one record into some variables.

dbGetLastErrorbp1ycrReturns in text of the last error to happen.

dbGetNextItembp1y0tReturns the record number of the next or previous item in the database

dbGetRecordCountbp1y0rReturns the number of records in the database

dbGetRecordFieldbp1y0mRetrieves the value of one column of one recorddbGetSaveStatusbp1y.tChecks if a database needs to be saved.

dbInsertColumnInd8j2.93Inserts a column

dbMakeNewItembp1y0kReturns the record number of a freshly created empty record

dbNameColumnbp1ycqNames a column of the database

dbOpenbp1yckOpens or creates a database, returns a handle

dbSavebp1ycpWrites a database to disk (Traditional model only)

dbSetDelimiterInd8j2.95Sets a new delimiter for disk-based activities.

dbSetOptionsInd8j2.98Set dynamic options for the database. These options can be changed at any time while the database is open.

dbSetEntireRecordbp1y0oWrites all columns into one record.

dbSetRecordFieldbp1y0lModifies one column of one record

dbSortbp1ycsSorts the database

dbSwapColumnsInd8j2.94Swaps two columns

Database Debugging Functions

dbDebugbp1y0sBrings up a dialog box with a table inside it that will allow very close examination and manipulation of the data.

dbGetVersionInd8j2.96Returns the version number of the extender DLL.dbSetErrorReportingInd8j2.97Allows quick and easy debugging of the LAFFDB functions.

Ÿ Mainkp1yckŸ Overview of LAFFDB Extenderconj37qwe


Sample Database

Sample DatabaseThe following code creates a sample CSV file, that can be used with each of the examples in this help file. This sample will attempt to create the file in the following location:

'"C:\Input DB\Sample.csv"'

Ÿ Mainkp1yckŸ Overview of LAFFDB Extenderconj37qwe

;***************************************************************************

;**  Creates a Sample database, to be used in other examples

;***************************************************************************

AddExtender("laffd34i.dll")

;***************************************************************************

;**   Example Database

;***************************************************************************

filename = "C:\Input DB\Sample.csv"

delimiter = ","

path = FilePath(filename)

if !DirExist(path) then DirMake(path)

if FileExist(filename) then FileDelete(filename)

;***************************************************************************

;**   dbOpen - create a Sample database, to be used in other examples

;***************************************************************************

bCreateOK = 1 ; if file does not exist, create an empty database.

model = 2     ; traditional

numcols = 7   ; number of columns

format = 0

optionstring = ""

handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)

if handle == @LAFFDBERROR

   err = dbGetLastError()

Message("Error Opening the database specified", err)

exit

Endif

;***************************************************************************

;**   Define data

;***************************************************************************

columnheadings = "CustID,LastName,FirstName,Address,City,State,Zip"

CustID = "1000,1001,1002,1003,1004,1005,1006,1007,1008,1009"

LastName = "Flintstone,Rubble,Flintstone,Rubble,Ball,Arnez,Boop,Dean,Monroe,Marley"

FirstName = "Fred,Barney,Wilma,Betty,Lucille,Desi,Betty,James,Marilyn,Bob"

Address = "1230 Stone Road,4560 Pebble Street,1230 Stone Road,4560 Pebble Street,55 Love Lane,55 Love Lane,1930 Boop-Boop-A-Doop Loop,1960 Desire Street,1962 Norma Jean Ave.,333 Reggae Road"

City = "BedRock,BedRock,BedRock,BedRock,TelevisionCity,TelevisionCity,Hollywood,Hollywood,Hollywood,St. Ann's Parish"

State = "AZ,AZ,AZ,AZ,CA,CA,CA,CA,CA,Jamaica"

Zip = "85000,85000,85000,85000,90201,90201,90068,90068,90068,10101"

;***************************************************************************

;**   Names a column of the database with a string.

;***************************************************************************

For columnnumber = 1 to numcols

  columnname = ItemExtract(columnnumber,columnheadings,",")

  ret = dbNameColumn(handle, columnnumber, columnname)

if ret == @LAFFDBERROR

  err = dbGetLastError()

  Message("Error Setting record field", err)

  endif

Next

;***************************************************************************

;**   Write data into database

;***************************************************************************

numrecords = 10

For  recordnum = 1 to numrecords

;**********************************************************

;**   dbMakeNewItem

;************************************************************

recordnum = dbMakeNewItem(handle, 1)

if recordnum == @LAFFDBERROR

err = dbGetLastError()

Message("Error Making a new entry", err)

endif

For columnnumber = 1 to numcols

  columnname = ItemExtract(columnnumber,columnheadings,",")

  value = ItemExtract(recordnum,%columnname%,",")

  ret = dbSetRecordField(handle, recordnum, columnname, 1|4, value)

  if ret == @LAFFDBERROR

     err = dbGetLastError()

     Message("Error Setting record field", err)

  endif

Next

Next

;***************************************************************************

;**   Saves Changes to database file

;***************************************************************************

ret = dbSave (handle, filename, "")

if ret == @LAFFDBERROR

err = dbGetLastError()

Message("Error Saving the database", err)

endif

;***************************************************************************

;**   Display contents of new database

;***************************************************************************

dbdebug(handle)

;***************************************************************************

;**   Closes Database handle

;***************************************************************************

ret = dbClose(handle)

if ret == @LAFFDBERROR

err = dbGetLastError()

Message("Error Closing the database", err)

endif

Exit


dbBindCol

dbBindCol

Binds a column of a database with a WIL variable. This information is referenced in the dbSetEntireRecord and dbGetEntireRecord functions.

Syntax:

dbBindCol(handle,column,varname)

Parameters:

(i) handle The handle of the database.

(i/s) column The number or name of the column.

(s) varname The name of a WIL variable

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find out what went wrong.
1: Success.

Example:

AddExtender("Laffd34i.dll")
;************************************************************************
;**   Example Database

;************************************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)

  str = "Make sure the database exists before attempting to run this example."

  str2 = "See the dbOpen example in this help file, it will create the example database for you."

  Message("Database doesn't exist", StrCat(str, @CRLF,str2))

  Exit

Endif

;************************************************************************
;**   dbOpen - open the test database
;************************************************************************
bCreateOK = 0 ;File MUST exist
model = 2  ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
   Message("Error Opening the database specified", err)
   exit
Endif

;************************************************************************
;**   Get Record Count
;************************************************************************
reccnt = dbGetRecordCount(handle)

;************************************************************************
;**   Get all records in the LastName Column - using dbBindCol
;************************************************************************
column = 2; Lastname
reclist = ""
ret = dbBindCol(handle, column, "LastName")
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Binding the column", err)
endif

For rec = 1 to reccnt

  ret = dbGetEntireRecord(handle, rec, 1)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error getting entire record", err)
endif

reclist = StrCat(reclist,@Tab,LastName)
Next
reclist = StrTrim(reclist)
AskItemList("Example: List of records in the LastName column",reclist,@tab,@unsorted,@single)

;************************************************************************
;**   Closes Database handle
;************************************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbSetEntireRecordbp1y0o, dbGetEntireRecordbp1y0n, dbGetLastErrorbp1ycr


dbCloneRecord

dbCloneRecord

Clones a record in the database.

Syntax:

dbCloneRecord(handle, recordnum, flags)

Parameters:

(i) handle The handle of the database.

(i) recordnum The record number of the item.

(i) flags Add together any of these values to achieve the particular goals.
Some values are exclusive, using both of them will result in an
error. If flags is zero, the bolded items will be assumed:

1: recordnum is a fixed record number
2: recordnum is a variable record number
4: Place the cloned record right after the source record
(preserves any sort order).
8: Return a fixed record number
16: return a variable record number
32: Place the cloned record at the end of the database
(could cause data to be unsorted)

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find
out what went wrong. Otherwise: The record number of
the newly cloned item

Example:

ret = AddExtender("Laffd34i.dll")

;***************************************************************
;**   Example Database
;***************************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;*****************************************************************
;**   dbOpen - open the test database
;*****************************************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;***************************************************************
;**   Get a list of records to display
;***************************************************************
reclist = ""
count = dbGetRecordCount(handle)
For record = 1 to count
reclist =Strcat(reclist, @tab, record)
Next
reclist = StrTrim(reclist);remove leading tab
recordnum = AskItemList("Choose record number to clone", reclist, @tab, @unsorted, @single)

;***************************************************************
;**   Clone a record
;***************************************************************
record = 0
ret = dbCloneRecord(handle, recordnum, 0) ;fixed record number | preserves sort order
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Cloning the record", err)
Endif

;***************************************************************
;**   dbDebug - to view the database with the Cloned Record
;***************************************************************
ret = dbDebug(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error using dbDebug", err)
endif

ret = AskYesNo('Do you want to save changes to the sample database?', 'if so, please press "YES"')
if ret == @YES
saveas = AskFileName("SelectFile", "C:\Output DB", "*.*", "ClonedRecord.csv", 0)
  ;***********************************************************************
  ;**   Saves Changes
;***********************************************************************
  ret = dbSave (handle, saveas, "")
  if ret == @LAFFDBERROR
                  err = dbGetLastError()
                  Message("Error Closing the database", err)
  endif
endif

;************************************************************************
;**   Closes Database handle
;***************************************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbFindRecordID__tq4np, dbDeleteRecordbp1y0p, dbGetRecordCountbp1y0r, dbGetLastErrorbp1ycr


dbClose

dbClose

Closes the database and frees any associated memory and resources. For traditional models, the disk file is not updated; use dbSave before calling this function unless your program is abandoning changes.

Syntax:

dbClose (handle)

Parameters:

(i) handle The handle of the database to close. For disk-based and
memory-based models, this function simply frees this handle.
Once the handle has been freed by this function, it is invalid.

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to
find out what went wrong.
1: Success

Example:

;****************************************************************
;**  Creates a Sample database, to be used in other examples
;****************************************************************
AddExtender("Laffd34i.dll")

;*****************************************************************
;**   Example Database
;*****************************************************************
filename = "C:\Input DB\Sample.csv"
delimiter = ","

path = FilePath(filename)
if !DirExist(path) then DirMake(path)
if FileExist(filename) then FileDelete(filename)

;*****************************************************************
;**   dbOpen - creates a Sample database, to be used in other examples
;*******************************************************************
bCreateOK = 1 ; if file does not exist, create an empty database.
model = 2     ; traditional
numcols = 7   ; number of columns
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
   Message("Error Opening the database specified", err)
   exit
Endif

;**********************************************************************
;**   Define data
;**********************************************************************
columnheadings = "CustID,LastName,FirstName,Address,City,State,Zip"
CustID = "1000,1001,1002,1003,1004,1005,1006,1007,1008,1009"
LastName = "Flintstone,Rubble,Flintstone,Rubble,Ball,Arnez,Boop,Dean,Monroe,Marley"
FirstName = "Fred,Barney,Wilma,Betty,Lucille,Desi,Betty,James,Marilyn,Bob"
Address = "1230 Stone Road,4560 Pebble Street,1230 Stone Road,4560 Pebble Street,55 Love Lane,55 Love Lane,1930 Boop-Boop-A-Doop Loop,1960 Desire Street,1962 Norma Jean Ave.,333 Reggae Road"
City = "BedRock,BedRock,BedRock,BedRock,TelevisionCity,TelevisionCity,Hollywood,Hollywood,Hollywood,St. Ann's Parish"
State = "AZ,AZ,AZ,AZ,CA,CA,CA,CA,CA,Jamaica"
Zip = "85000,85000,85000,85000,90201,90201,90068,90068,90068,10101"

;**********************************************************************
;**   Names a column of the database with a string.
;**********************************************************************
For columnnumber = 1 to numcols
  columnname = ItemExtract(columnnumber,columnheadings,",")
  ret = dbNameColumn(handle, columnnumber, columnname)
if ret == @LAFFDBERROR
  err = dbGetLastError()
  Message("Error Setting record field", err)
endif
Next

;**********************************************************************
;**   Write data into database
;**********************************************************************
numrecords = 10
For  recordnum = 1 to numrecords
;********************************************
;**   dbMakeNewItem
;**************************************************
recordnum = dbMakeNewItem(handle, 1)
if recordnum == @LAFFDBERROR
  err = dbGetLastError()
  Message("Error Making a new entry", err)
endif

For columnnumber = 1 to numcols
  columnname = ItemExtract(columnnumber,columnheadings,",")
  value = ItemExtract(recordnum,%columnname%,",")
ret = dbSetRecordField(handle, recordnum, columnname, 1|4, value)
  if ret == @LAFFDBERROR
     err = dbGetLastError()
Message("Error Setting record field", err)
  endif
     Next
Next

;*************************************************************
;**   Saves Changes to database file
;*************************************************************
ret = dbSave (handle, filename, "")
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Saving the database", err)
endif

;**************************************************************
;**   Display contents of new database
;**************************************************************
dbdebug(handle)

;**************************************************************
;**   Closes Database handle
;**************************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif
Exit

See Also:

dbOpenbp1yck, dbSavebp1ycp, , dbGetLastErrorbp1ycr


dbCookDatabases

dbCookDatabases

Performs a variety of operations on databases A and B, such as merging, ANDing, etc. A new database C is created and returned.

Syntax:

dbCookDatabases ( filename, model, format, delimiter, optionstring, handleA, handleB, operation, flags, columnlayout, matchingcriteria)

Parameters:

(s) filename The filename to use for this file. For the memory-based model,
this parameter is ignored.

(i) model 0 - Disk-based
1 - Memory-Based
2 - Traditional

(i) format 0 - Delimiter-based
1 - Space-separator based. If a column's data has a space, the
column must be in quotes
2 - Fixed columns

(s) delimiter Used only if format is 0 or 2. Specifies the delimiter to use to
separate the columns. Note: the delimiter must be a low ascii delimiter

(s) optionstring See Below.

(i) handleA The handle of the first database (A).

(i) handleB The handle of the second database (B).

(i) operation The type of operation to perform. See Below

(i) flags Reserved. Specify zero.

(s) columnlayout A string containing a series of triads that will define the layout of
the new database.

(s)matchingcriteria A string containing a series of codes that instruct LAFFDB how to
determine if two fields are the same.

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find out what went wrong.
Otherwise: The handle of the new database.

OptionString

If the model is traditional (2) or disk-based (0), then this value is only used if the format value is 2 (fixed columns). In that case, optionstring is a string of numerical values that specify the number of characters per field, each separated by a space. For example, if the first column was four characters, and second column was 12 characters, and the third column was 6 characters, optionstring would be set to the value of "4 12 6"

If the model is memory-based, then this string specifies the maximum string size for each column. If the value is 0, then the maximum string size is 65535 characters. For example, if the database to create was the "SSIFS" example as cited in the datatypestring parameter, and optionstring was "4 12 0 0 34", then column 1 would be at maximum four bytes, and column 2 would be at maximum 12 bytes. Columns 3 and 4 are up to 65535 characters. Column 5 would be a maximum of 34 bytes.

If the model is memory-based, and this string is left blank, then each column string can be up to 65535 characters.

Operation

The type of operation to perform.

0 | Add, C = A+B. If the same record exists in both A and B, then C will contain two copies of the record.
1 | Subtract, C = A-B. If the same record exists in both A and B, then C will not contain that record.
2 | OR, C = A | B. Like addition, except if the same record exists in both A and B, then C will only contain one instance of that record.
3 | AND, C = A & B. C will only contain records that are in both A and B.
4 | NOT, C = A ! B. C will only contain records exclusive to either A or B.
5 | Remove Duplicates from A. C = A - duplicates
6 | Leave only duplicates from A. C = Duplicates in A
7 | Inner Join. This is the SQL Inner Join. See notes below.
8 | Left Join. This is the SQL Left Join. See notes below.

Columnlayout

Each triad is composed of three comma separated values, and represents one column in Database C:

dbACol,dbBCol,dbCCol

Where dbACol is the name or number of the column in Database A, dbBCol is the name or number of the column in Database B, and dbCCol is the name of the newly created column in Database C.

For example, if you want to create a column named "Orange" in Database C that is the result of an operation on the "Red" column in Database A and the "Yellow" column in Database "B", the triad would look like this:

Red,Yellow,Orange

If a column name has a space or a comma in it, then you need to use the pipe ( | ) symbol wrapped around the column name. For example, if the Yellow column was actually named Bright Yellow, then the triad would look like this:

Red,|Bright Yellow|,Orange

If a column name has a pipe in it's description, use a double pipe ( || ). For example, if the Yellow column was actually named Bright|Yellow, then the triad would look like this:

Red,Bright||Yellow,Orange

For some operations (such as Add), it is not necessary for the columns to exist in both Database A and Database B. If the column does not exist in a database, use a tilde ( ~ ) in its place, followed by a default value in pipes. For example, if you were creating a column named "Favorite Color" in database C, and that column only existed in database A, and you wanted the default value to be "Purple", then the triad would look like this:

|Favorite Color|,~|Purple|,|Favorite Color|

For the above example, if there were records created that only existed in database B, the resulting field in Database C would be set to "Purple"

Each column in the new database has a triad. Let's look at two databases:

Database A: Has three columns named Red, Green, and Blue

Database B: Has three columns named Red, Green, and Magenta

If you wanted to create a new three column database C, with the columns Green,Blue,and Magenta, then you could set up a columnlayout like this:

Green,Green,Green Blue,~|foo|,Blue ~|bar|,Magenta,Magenta

In this example, the Blue column would have default values of "foo" and the Magenta column would have default values of "bar". The Red columns from Database A and B would not be included in Database C.

If this field is left blank, LAFFDB will make a column layout that consists of all of the columns from Database A and Database B, with empty strings for the default values:

Red,Red,Red Green,Green,Green Blue,~||,Blue ~||,Magenta,Magenta

MatchingCriteria

A string containing a series of codes that instruct LAFFDB how to determine if two fields are the same. This is necessary for all operations except Add. There is one code for each column, seperated by a space. Each code can be one of the following values:

Code | Meaning
E | character, case sensitive match
e | character, case insensitive match
* | 't care. The rest of the string is irrelevant
? | 't care (this character always matches)
K,<string> | match a key specified by <string>. Case Sensitive.
k,<string> | match a key specified by <string>. Case Insensitive.
W,<pattern>,f | using a specified pattern, and specify which value to use in Database C (f = A or B). The pattern is composed of "E", "e", "?", and "*":

For example, the code

W,<Ee?ee*>,B

would provide the following truth table:

Val A | Val B | Match? | Value in C
Dave |  |  |
DAVE |  |  |
Dave |  |  |
David |  |  |

For example, if you were creating a three column database C, you could use a matchingcriteria string like this:

E * W,<Ee?ee*>,B

Where the first column requires an exact case sensitive match, the second column always matches, and the third column uses the pattern matching.

Notes

The SQL Inner Join and SQL Left Join operations attempt to do the same thing that an SQL database would do. For the following examples, we need to have a couple databases to start with:

TABLE1.TXT

ID,Name

01,”Hansen, Ola”

02,”Svendson, Tove”

03,”Svendson, Stephen”

04,”Pettersen, Kari”

TABLE2.TXT

ID,Product

01,Printer

03,Table

03,Chair

An Inner Join creates a new database that is based upon information in the two other databases. It creates NEW records that are based on the old tables versus comparing records, as the other LAFFDB operations do. As a result, it is possible to have more records result from an Inner Join than are in the first two databases alone.

In TABLE1.TXT, we have ID’s of people. In TABLE2.TXT, we have a list of products that have been ordered. The ID in TABLE2.TXT refers to which employee from TABLE1.TXT bought the product. If we wanted to do an Inner Join, we would think of it as the question: “Who has ordered a product, and what did they order?”. Here is how you would do this in LAFFDB:

; Open the two databases, using the first line as headers

iHandleA = dbOpen ( "C:\table1.txt", 2, 2, -1, 0, ",", "" )

iHandleB = dbOpen ( "C:\table2.txt", 2, 2, -1, 0, ",", "" )

; Three triads for the layout of the created databse C

;

; The first triad says we want to use the ID from TABLE1, the ID from TABLE2, and

; make an ID in COOK.TXT

;

; The second triad says we want to use the Name from TABLE1, nothing from TABLE2, and

; make a Name in COOK.TXT

;

; The third triad says we want nothing from TABLE1, the Product from TABLE2, and make

; a Product in COOK.TXT

layout = "ID,ID,ID Name,~|<error1>|,Name ~|<error2>|,Product,Product"

; Three sets of information for the matching info

;

; The first set says that the ID from TABLE1 and TABLE2 must be an exact match

;

; The second set says the Name is not checked for a match (after all, it’s only

; in TABLE1, and to grab the value for COOK.TXT from database A (TABLE1).

;

; The third set says the Product is not checked for a match (it’s only in TABLE2),

; and to grab the value for COOK.TXT from database B (TABLE2)

matchinfo = "E,a *,a *,b"

iHandleC = dbCookDatabases ("C:\cook.txt", 2, 0, ",", "", iHandleA,

                           iHandleB, 7, 0, layout, matchinfo )

The end result of the above code looks like this:

01,"Hansen, Ola",Printer

03,"Svendson, Stephen",Table

03,"Svendson, Stephen",Chair

An SQL Left Join uses all the items from the left database (Database A, or TABLE1.TXT in our example) versus only the items that match the criteria. To see a Left Join, you would ask the question: List all employees, and their orders - if any. Using the same code as above, except changing the operation to Left Join would yield the following:

01,"Hansen, Ola",Printer

02,"Svendson, Tove",

03,"Svendson, Stephen",Table

03,"Svendson, Stephen",Chair

04,"Pettersen, Kari",

If you wanted to list all employees, and their printer orders, if any, you would change the matchinfo to "E,a *,a K,b,Printer"

Example:

;**************************************************

;** This sample adds two databases together. In this case it adds the
;** sample database to itself. It will create a resulting database
;** with a duplicate record of every record in the source database.
;**************************************************

ret = AddExtender("Laffd34i.dll")

;**************************************************
;**   dbOpen - open the test database A
;**************************************************
inputfilename = "C:\Input DB\sample.csv"
if !FileExist(inputfilename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif
delimiter = ","
bCreateOK = 0
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0    ;Delimiter based
optionstring = ""
handleA = dbOpen (inputfilename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handleA == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database A specified", err)
exit
Endif

;**************************************************
;**   dbOpen - open the test database B
;**************************************************
ret = AskYesno("dbCookDatabases","Would you like to create a copy of the original database?")
if ret == @no
dbClose(handleA)
exit
endif

if !FileExist(inputfilename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

inputfilename2 = StrCat(FilePath(inputfilename),FileRoot(inputfilename),"2.",FileExtension(inputfilename))

if FileExist(inputfilename2)
  FileDelete(inputfilename2)
Endif
FileCopyAttr(inputfilename,inputfilename2,@False,"r")

delimiter = ","
bCreateOK = 0
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0    ;Delimiter based
optionstring = ""
handleB = dbOpen (inputfilename2, bCreateOK, model, numcols, format, delimiter, optionstring)
if handleB == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database B specified", err)
exit
Endif

outputfilename = "C:\Output DB\Cooked.CSV"
path = filepath(outputfilename)
if !DirExist(path)
  Message("Note",strcat("Creating the directory ", path))
DirMake(path)
endif
if FileExist(outputfilename) then FileDelete(outputfilename)
model = 2      ;Traditional
format = 0     ;Delimiter based
delimiter =  ","
optionstring = ""
operation =  0 ;Add, C = A+B. If the same record exists in both A and B, then C will contain two copies of the record.
flags = 0
columnlayout = "CustID,CustID,CustID LastName,LastName,LastName FirstName,FirstName,FirstName Address,Address,Address City,City,City State,State,State Zip,Zip,Zip"
matchingcriteria = "*"
handle = dbCookDatabases ( outputfilename, model, format, delimiter, optionstring, handleA, handleB, operation, flags, columnlayout, matchingcriteria)
if handle == @LAFFDBERROR
err = dbGetLastError()
Message("Error Cooking the database", err)
endif

;**************************************************
;**   dbDebug - to view the database with the column removed
;**************************************************
ret = dbDebug(handle)
if ret == 0
err = dbGetLastError()
Message("Error using dbDebug", err)
endif

ret = AskYesNo('Do you want to save changes to the sample database?', 'if so, please press "YES"')
if ret == @YES
saveas = AskFileName("SelectFile", "C:\Output DB", "*.*", "Cooked.csv", 0)
  ;**************************************************
  ;**   Saves Changes
  ;**************************************************
  ret = dbSave (handle, saveas, "")
  if ret == 0
                  err = dbGetLastError()
                  Message("Error Saving the database", err)
  endif
endif

;**************************************************
;**   Closes Database handles
;**************************************************
ret = dbClose(handleA)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif
ret = dbClose(handleB)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif

exit

See Also:

dbOpenbp1yck, dbClosebp1ycl, dbSavebp1ycp, dbGetLastErrorbp1ycr


dbDebug

dbDebug

Brings up a dialog box with a table inside it that will allow very close examination and manipulation of the data.

Syntax:

dbDebug(handle)

Parameters:

(i) handle The handle of the database.

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find out what went wrong.
1: Success.

The dialog generated by dbDebug, will look something like this:

You can click on any cell and change the values on the fly. You will also be able to view this as a hex dump on 16 byte boundaries.

Note: The dbDebug screen does not scale at lower screen resolutions.

Example:

ret = AddExtender("Laffd34i.dll")
;*******************************************************
;**   dbGetVersion
;*******************************************************
ver = dbGetVersion()
message("LAFFDB Extender Version",ver)

;*******************************************************
;**   Example Database
;*******************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;*******************************************************
;**   dbOpen - open the test database
;*******************************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;*******************************************************
;**   dbDebug
;*******************************************************
ret = dbDebug(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error using dbDebug", err)
endif

;*******************************************************
;**   Closes Database handle
;*******************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbSetErrorReportingInd8j2.97, dbGetLastErrorbp1ycr


dbDeleteColumn

dbDeleteColumn

Removes a column from the database.

Syntax:

dbDeleteColumn (handle, column)

Parameters:

(i) handle The handle of the database.

(i/s) column The number or name of the column.

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find out what went wrong.
1: Success

Example:

ret = AddExtender("Laffd34i.dll")

;***********************************************************
;**   Example Database
;***********************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;***********************************************************
;**   dbOpen - open the test database
;***********************************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;***********************************************************
;**   Get a list of columns to display
;***********************************************************
columnlist = ""
count = dbGetColumnCount(handle)
For column = 1 to count
name = dbGetColumnName (handle, column)
if name == ""
 err = dbGetLastError()
    Message("Error getting column name", err)
endif
columnlist =Strcat(columnlist, @tab, name)
Next
columnlist = StrTrim(columnlist);remove leading tab

While @true ;Make sure the user selects a column
  columnname = AskItemList("Choose column to Delete", columnlist, @tab, @unsorted, @single)
  if columnname != "" then break
endwhile

;***********************************************************
;**   dbDeleteColumn
;***********************************************************
ret = dbDeleteColumn (handle, columnname)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Inserting the Column", err)
endif

;***********************************************************
;**   dbDebug - to view the database with the column removed
;***********************************************************
ret = dbDebug(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error using dbDebug", err)
endif

ret = AskYesNo('Do you want to save changes to the sample database?', 'if so, please press "YES"')
if ret == @YES
saveas = AskFileName("SelectFile", "C:\Output DB", "*.*", "DeletedColumn.csv", 0)
  ;***********************************************************
  ;**   Saves Changes
  ;***********************************************************
  ret = dbSave (handle, saveas, "")
  if ret == @LAFFDBERROR
                  err = dbGetLastError()
                  Message("Error Saving the database", err)
  endif
endif

;***********************************************************
;**   Closes Database handle
;***********************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbDeleteRecordbp1y0p , dbGetLastErrorbp1ycr


dbDeleteRecord

dbDeleteRecord

Deletes a record from the database.

Syntax:

dbDeleteRecord(handle, recordnum, flags)

Parameters:

(i) handle The handle of the database.

(i) recordnum The record number of the item.

(i) flags Add together any of these values to achieve the particular goals.
Some values are exclusive, using both of them will result in an
error. If flags is zero, the bolded items will be assumed:

1: recordnum is a fixed record number
2: recordnum is a variable record number

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find out what went wrong.
1: Success.

Example:

ret = AddExtender("laffd34i.dll")

;********************************************************
;**   Example Database
;********************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;********************************************************
;**   dbOpen - open the test database
;********************************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;********************************************************
;**   Get a list of records to display
;********************************************************
reclist = ""
count = dbGetRecordCount(handle)
For record = 1 to count
reclist =Strcat(reclist, @tab, record)
Next
reclist = StrTrim(reclist);remove leading tab
recordnum = AskItemList("Choose record number to delete", reclist, @tab, @unsorted, @single)
if recordnum == ""
  Message("Opps","You must chose a record number, now exiting")
exit
endif

;********************************************************
;**   Delete chosen record
;********************************************************
answer = AskYesNo( "Delete Record?", "Do you want to delete this record number: %recordnum%")
If answer == @YES
ret = dbDeleteRecord(handle, recordnum, 1)
if ret == @LAFFDBERROR
  err = dbGetLastError()
  Message("Error deleting record: %ret% ", err)
  endif
Endif

;********************************************************
;**   dbDebug - to view the database with the record removed
;********************************************************
ret = dbDebug(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error using dbDebug", err)
endif

ret = AskYesNo('Do you want to save changes to the sample database?', 'if so, please press "YES"')
if ret == @YES
saveas = AskFileName("SelectFile", "C:\Output DB", "*.*", "DeletedRecord.csv", 0)
  ;********************************************************
  ;**   Saves Changes
  ;********************************************************
  ret = dbSave (handle, saveas, "")
  if ret == @LAFFDBERROR
                  err = dbGetLastError()
                  Message("Error Saving the database", err)
  endif
endif

;********************************************************
;**   Closes Database handle
;********************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbDeleteColumn ,, dbGetLastErrorbp1ycr


dbExist

dbExist

Check if database handle is valid.

Syntax:

dbExist( handle )

Parameters:

(i) handle The handle of the database.

Returns:

(i) 0: not a valid database handle
1: a valid database handle

Example:

ret = AddExtender("laffd34i.dll")

;********************************************************
;**   Example Database
;********************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
  exit
Endif

;********************************************************
;**   dbOpen - open the test database
;********************************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
   Message("Error Opening the database specified", err)
   exit
Endif

;********************************************************
;**   dbExist – Test handle to database
;********************************************************
ret = dbExist(handle)
if ret == @false
   Message("dbExist", "Invalid database handle")
else
   Message("dbExist", "Valid database handle")
   dbClose(handle)
endif
exit

SeeAlso:

dbOpenbp1yck


dbFindRecord

dbFindRecord

Searches the database, beginning after a specified record number, for a record that has a specified column value that matches the findvalue parameter. This function is used when a database resort is not desired.

Syntax:

dbFindRecord(handle,recordnum,flags,column,findvalue,matchcase)

Parameters:

(i) handle The handle of the database.

(i) recordnum The record number of the item to begin the find operation on.
This record is not searched. Use -1 to begin at the beginning of
the database.

(i) flags Add together any of these values to achieve the particular goals.
Some values are exclusive, using both of them will result in an
error. If flags is zero, the bolded items will be assumed:

1: recordnum is a fixed record number
2: recordnum is a variable record number
4: return a fixed record number
8: return a variable record number
16: Search backwards

(i/s) column The number or name of the column.

(s/i/f) findvalue The value to search for.

(i) matchcase Determines whether the comparision for text fields is case
sensitive or not.
0 NOT case sensitive
1 case sensitive

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find out what went wrong.
-1: No matching record found
Otherwise: Record number of record meeting find criteria

Example:

AddExtender("Laffd34i.dll")

;*****************************************************

;**   Example Database

;*****************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
  exit
Endif

;*****************************************************
;**   dbOpen - open the test database
;*****************************************************
bCreateOK = 0 ;File MUST exist
model = 2  ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()

Message("Error Opening the database specified", err)
exit
Endif

recordnum = -1 ;search entire database
flags = 1|4; fixed record number
column = "LastName"; column nmae to search in
findvalue = "Marley"
matchcase = 0 ;NOT case sensitive

;*****************************************************
;**   dbFindRecord
;*****************************************************
record = dbFindRecord(handle,recordnum,flags,column,findvalue,matchcase)
if record == @LAFFDBERROR

   err = dbGetLastError()
Message("Error finding record", err)
exit
Endif
if record == -1 ;No matching record found
 Message("dbFindRecord", "Record not found")
 exit
endif

;*****************************************************
;**   Closes Database handle
;*****************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Message("Found",StrCat(findvalue, " at record number ", record))

Exit

See Also:

dbCloneRecordbp1y0q, dbDeleteRecordbp1y0p, dbGetEntireRecordbp1y0n,, dbGetLastErrorbp1ycr


dbGetColumnCount

dbGetColumnCount

Returns the number of columns in a database.

Syntax:

dbGetColumnCount (handle)

Parameters:

(i) handle The handle of the database.

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find out what went wrong.
Or The number of columns in the database.

Example:

AddExtender("Laffd34i.dll")

;***********************************************************
;**   Example Database
;***********************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;***********************************************************
;**   dbOpen - open the test database
;***********************************************************
bCreateOK = 0 ;File MUST exist
model = 2  ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;***********************************************************
;**   Get a list of columns to display
;***********************************************************
columnlist = ""
count = dbGetColumnCount(handle)
For column = 1 to count
name = dbGetColumnName (handle, column)
if name == ""
 err = dbGetLastError()
    Message("Error getting column name", err)
endif
columnlist =Strcat(columnlist, @tab, name)
Next
columnlist = StrTrim(columnlist);remove leading tab
columnname = AskItemList("Choose column to get records from", columnlist, @tab, @unsorted, @single)

;***********************************************************
;**   Get all records in the chosen Column - using dbGetNextItem
;***********************************************************
recordnum = -1 ;get the first item
flag = 16

list = ""
While @true
 recordnum = dbGetNextItem(handle, recordnum, flag)
 flag = 2 ;variable record number
 if recordnum == -1 then break ;Reached end of database
 if recordnum == @LAFFDBERROR
err = dbGetLastError()
   Message("Error getting next record", err)
 endif

 field = dbGetRecordField(handle, recordnum, columnname, 2)
 list = strcat(list,@tab,field)
EndWhile

list = StrTrim(list)
AskItemList("List of records in the %columnname% column", list, @tab, @unsorted, @single)

;***********************************************************
;**   Closes Database handle
;***********************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif
exit

See Also:

dbGetColumnNamebp1ycm, dbGetColumnNumberbp1y.l, dbGetColumnType , dbGetLastErrorbp1ycr


dbGetColumnName

dbGetColumnName

Returns the name of a column in the database (if they are named)

Syntax:

dbGetColumnName (handle, column)

Parameters:

(i) handle The handle of the database.

(i) column The number of the column.

Returns:

(s) "" on Error. Use dbGetLastError to find out what went wrong.
Otherwise it is the name of the column.

Example:

AddExtender("Laffd34i.dll")
;*******************************************************
;**   Example Database
;*******************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;*******************************************************
;**   dbOpen - open the test database
;*******************************************************
bCreateOK = 0 ;File MUST exist
model = 2  ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;*******************************************************
;**   Get a list of columns to display
;*******************************************************
columnlist = ""
count = dbGetColumnCount(handle)
For column = 1 to count
name = dbGetColumnName (handle, column)
if name ==""
 err = dbGetLastError()
    Message("Error getting column name", err)
endif
columnlist =Strcat(columnlist, @tab, name)
Next
columnlist = StrTrim(columnlist);remove leading tab
columnname = AskItemList("Choose column to get records from", columnlist, @tab, @unsorted, @single)

;*******************************************************
;**   Get all records in the chosen Column - using dbGetNextItem
;*******************************************************
recordnum = -1 ;get the first item
flag = 16

list = ""
While @true
 recordnum = dbGetNextItem(handle, recordnum, flag)
 flag = 2 ;variable record number
 if recordnum == -1 then break ;Reached end of database
 if recordnum == @LAFFDBERROR
err = dbGetLastError()
Message("Error getting next record", err)
 endif

 field = dbGetRecordField(handle, recordnum, columnname, 2)
 list = strcat(list,@tab,field)
EndWhile

list = StrTrim(list)
AskItemList("List of records in the %columnname% column", list, @tab, @unsorted, @single)

;*******************************************************
;**   Closes Database handle
;*******************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif
exit

See Also:

dbGetColumnType , dbGetColumnCountbp1yco , dbGetColumnNumberbp1y.l, dbGetLastErrorbp1ycr


dbGetColumnNumber

dbGetColumnNumber

Returns the integer column number of a named column, given the name.

Syntax:

dbGetColumnNumber( handle, name )

Parameters:

(i) handle The handle of the database.
(s) name The name of the column

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find
out what went wrong.
n: The number of the column in question (either 0-based
or 1-based, depending on the dbSetOptions parameters).

Example:

AddExtender("Laffd34i.dll")

;*******************************************************
;**   Example Database
;*******************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;*******************************************************
;**   dbOpen - open the test database
;*******************************************************
bCreateOK = 0 ;File MUST exist
model = 2  ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;*******************************************************
;**   Get a list of column names to display
;*******************************************************
columnlist = ""
count = dbGetColumnCount(handle)
For column = 1 to count
name = dbGetColumnName (handle, column)
if name ==""
 err = dbGetLastError()
    Message("Error getting column name", err)
endif
columnlist =Strcat(columnlist, @tab, name)
Next
columnlist = StrTrim(columnlist);remove leading tab
columnname = AskItemList("Choose column name to get the column number", columnlist, @tab, @unsorted, @single)

;*******************************************************
;**   Get the column number of column name chosen
;*******************************************************
columnnumber = dbGetColumnNumber( handle, columnname )
if columnnumber == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Getting Column Number", err)
exit
Endif
Message(StrCat("Column number of a named column: ",columnname),columnnumber)

;*******************************************************
;**   Closes Database handle
;*******************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif
exit

See Also:

dbGetColumnCountbp1yco, dbGetColumnNamebp1ycm , dbGetColumnTypebp1ycn, dbGetLastErrorbp1ycr


dbGetColumnType

dbGetColumnType

Returns the data type of a column in the database. LAFFDB figures this automatically.

Syntax:

dbGetColumnType (handle, column)

Parameters:

(i) handle The handle of the database.

(i/s) column The number or the name of the column.

Returns:

(s) “S” - String
“I” - Integer (no decimal point)
“F” - Floating Point
"E" - Error. Use dbGetLastError to find out what went wrong.

Example:

AddExtender("Laffd34i.dll")

;******************************************************
;**   Example Database
;******************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;******************************************************
;**   dbOpen - open the test database
;******************************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;******************************************************
;**   dbGetColumnCount
;******************************************************
colcnt = dbGetColumnCount (handle)

;******************************************************
;**   Get Record Count
;******************************************************
reccnt = dbGetRecordCount(handle)

;******************************************************
;**   Get a list of column names
;******************************************************
collist = ""
For col = 1 to colcnt
colname = dbGetColumnName (handle, col)
if colname ==""
  err = dbGetLastError()
  Message("Error getting column name from the database", err)
endif

coltype = dbGetColumnType (handle, col)
if coltype =="E"
  err = dbGetLastError()
  Message("Error getting column type from the database", err)
endif
collist = strcat(collist,@tab,"[Type ",coltype,"] ",colname)
Next
collist = StrTrim(collist)
colinfo = AskItemList("Column types and names: Choose a Column to query the records",collist,@tab,@unsorted,@single)

;******************************************************
;**   Closes Database handle
;******************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif
Exit

See Also:

dbGetColumnCountbp1yco, dbGetColumnNamebp1ycm , dbGetColumnNumberbp1y.l, dbGetLastErrorbp1ycr


dbGetEntireRecord

dbGetEntireRecord

Retrieves an entire row of data into WIL variables as previously defined with the dbBindCol functon. If the row of data contains columns not defined by a previous dbBindCol, then those columns are ignored. Only fields defined with a dbBindCol are stored.

Syntax:

dbGetEntireRecord(handle, recordnum, flags)

Parameters:

(i) handle The handle of the database.

(i) recordnum The record number of the item.

(i) flags Add together any of these values to achieve the particular goals.
Some values are exclusive, using both of them will result in an
error. If flags is zero, the bolded items will be assumed:

1: recordnum is a fixed record number
2: recordnum is a variable record number
4: Require all columns to be bound with dbBindCol

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find out what went wrong.
1: Success.

Example:

AddExtender("Laffd34i.dll")
;********************************************************
;**   Example Database
;********************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;********************************************************
;**   dbOpen - open the test database
;*******************************************************
bCreateOK = 0 ;File MUST exist
model = 2  ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;********************************************************
;**   Get Record Count
;********************************************************
reccnt = dbGetRecordCount(handle)

;********************************************************
;**   Get all records in the LastName Column - using dbBindCol
;********************************************************
column = 2; Lastname
reclist = ""
ret = dbBindCol(handle, column, "LastName")
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Binding the column", err)
endif

For rec = 1 to reccnt

  ret = dbGetEntireRecord(handle, rec, 1)
if ret == @LAFFDBERROR
  err = dbGetLastError()
  Message("Error getting entire record", err)
endif
  reclist = StrCat(reclist,@Tab,LastName)
Next
reclist = StrTrim(reclist)
AskItemList("Example: List of records in the LastName column",reclist,@tab,@unsorted,@single)

;********************************************************
;**   Closes Database handle
;********************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif
Exit

See Also:

dbSetEntireRecord , dbGetLastErrorbp1ycr


dbGetLastError

dbGetLastError

Gets a text description of the last error to happen while using LAFFDB.

Syntax:

dbGetLastError()

Parameters:

None

Returns:

(s) A character string that describes the last error.

Example:

AddExtender("Laffd34i.dll")

;**********************************************************
;**   Example Database
;**********************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;**********************************************************
;**   dbOpen - open the test database
;**********************************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;**********************************************************
;**   dbGetColumnCount
;**********************************************************
colcnt = dbGetColumnCount (handle)

;**********************************************************
;**   Get Record Count
;**********************************************************
reccnt = dbGetRecordCount(handle)

;**********************************************************
;**   Get a list of column names
;**********************************************************
collist = ""
For col = 1 to colcnt
  colname = dbGetColumnName (handle, col) ; Expects zero based column numbers
  if colname ==""
     err = dbGetLastError()
      Message("Error getting column name from the database", err)
  endif
  coltype = dbGetColumnType (handle, col); Expects zero based column numbers
  if coltype =="E"
     err = dbGetLastError()
     Message("Error getting column type from the database", err)
  endif
  collist = strcat(collist,@tab,"[Type ",coltype,"] ",colname)
Next
collist = StrTrim(collist)
colinfo = AskItemList("Column types and names: Choose a Column to query the records",collist,@tab,@unsorted,@single)

;**********************************************************
;**   Closes Database handle
;**********************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif
Exit

See Also:

dbDebugbp1y0s, dbSetErrorReporting ,, dbGetLastErrorbp1ycr


dbGetNextItem

dbGetNextItem

Returns the record number of the next or previous item in the database. The record number can be the fixed record number (which never changes, even with sorts), or the variable record number (which can change with a sort or the insertion/deletion of a record).

Syntax:

dbGetNextItem(handle, recordnum, flags)

Parameters:

(i) handle The handle of the database.

(i) recordnum -1 Returns the value specified by flags 16 or 32.
If not -1: Returns the record after the specified recordnum,
according to flags.

(i) flags Add together any of these values to achieve the particular goals.
Some values are exclusive, using both of them will result in an
error. If flags is zero, the bolded items will be assumed:

1: recordnum is a fixed record number.
2: recordnum is a variable record number
4: return a fixed record number
8: return a variable record number
16: return the first item in the database
32: return the last item in the database
64: return the previous item versus the next item

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find out what went wrong.
-1: End of database (or beginning of database) reached.
0 or Positive number: The record number of the next (or previous) item.

Example:

AddExtender("Laffd34i.dll")

;*****************************************************
;**   Example Database
;*****************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;*****************************************************
;**   dbOpen - open the test database
;*****************************************************
bCreateOK = 0 ;File MUST exist
model = 2  ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;*****************************************************
;**   Get a list of columns to display
;*****************************************************
columnlist = ""
count = dbGetColumnCount(handle)
For column = 1 to count
name = dbGetColumnName (handle, column)
if name == ""
 err = dbGetLastError()
    Message("Error getting column name", err)
endif
columnlist = Strcat(columnlist, @tab, name)
Next
columnlist = StrTrim(columnlist);remove leading tab

While @true ;Make sure the user selects a column
  columnname = AskItemList("Choose column to get records from", columnlist, @tab, @unsorted, @single)
  if columnname != "" then break
endwhile

;*****************************************************
;**   Get all records in the chosen Column - using dbGetNextItem
;*****************************************************
recordnum = -1 ;get the first item
flag = 16

list = ""
While @true
 recordnum = dbGetNextItem(handle, recordnum, flag)
 flag = 2 ;variable record number
 if recordnum == -1 then break ;Reached end of database
 if recordnum == @LAFFDBERROR
err = dbGetLastError()
   Message("Error getting next record", err)
 endif

 field = dbGetRecordField(handle, recordnum, columnname, 2)
 if field == @LAFFDBERROR
err = dbGetLastError()
   Message("Error getting record field", err)
 endif

 list = strcat(list,@tab,field)
EndWhile

list = StrTrim(list)
AskItemList("List of records in the %columnname% column", list, @tab, @unsorted, @single)

;*****************************************************
;**   Closes Database handle
;*****************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif
exit

See Also:

dbGetRecordField , dbGetLastErrorbp1ycr


dbGetRecordCount

dbGetRecordCount

Returns the number of records in the database.

Syntax:

dbGetRecordCount(handle)

Parameters:

(i) handle The handle of the database.

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find out what went wrong.
0 or greater: Success.

Example:

AddExtender("Laffd34i.dll")

;****************************************************
;**   Example Database
;****************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;****************************************************
;**   dbOpen - open the test database
;****************************************************
bCreateOK = 0 ;File MUST exist
model = 2  ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;****************************************************
;**   Get Record Count
;****************************************************
reccnt = dbGetRecordCount(handle)

;****************************************************
;**   Get all records in the LastName Column - using dbBindCol
;****************************************************
column = 2; Lastname
reclist = ""
ret = dbBindCol(handle, column, "LastName")
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Binding the column", err)
endif

For rec = 1 to reccnt

  ret = dbGetEntireRecord(handle, rec, 1)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error getting entire record", err)
endif

reclist = StrCat(reclist,@Tab,LastName)
Next
reclist = StrTrim(reclist)
AskItemList("Example: List of records in the LastName column",reclist,@tab,@unsorted,@single)

;****************************************************
;**   Closes Database handle
;****************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif
Exit

See Also:

dbGetColumnCount , dbGetLastErrorbp1ycr


dbGetRecordField

dbGetRecordField

Retrieves the value of a column (field) in a record.

Syntax:

dbGetRecordField(handle, recordnum, column, flags)

Parameters:

(i) handle The handle of the database.

(i) recordnum The record number of the item.

(i/s) column The number or name of the column.

(i) flags Add together any of these values to achieve the particular goals.
Some values are exclusive, using both of them will result in an
error. If flags is zero, the bolded items will be assumed:

1: recordnum is a fixed record number
2: recordnum is a variable record number

Returns:

(i/s/f) The value of the column data.
@LAFFDBERROR: If an error occurs, it will be available via dbGetLastError ()

Example:

AddExtender("Laffd34i.dll")
;******************************************************
;**   Example Database
;******************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;******************************************************
;**   dbOpen - open the test database
;******************************************************
bCreateOK = 0 ;File MUST exist
model = 2  ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;******************************************************
;**   Get a list of columns to display
;******************************************************
columnlist = ""
count = dbGetColumnCount(handle)
For column = 1 to count
name = dbGetColumnName (handle, column)
if name == ""
 err = dbGetLastError()
    Message("Error getting column name", err)
endif
columnlist =Strcat(columnlist, @tab, name)
Next
columnlist = StrTrim(columnlist);remove leading tab
columnname = AskItemList("Choose column to get records from", columnlist, @tab, @unsorted, @single)

;******************************************************
;**   Get all records in the chosen Column - using dbGetNextItem
;******************************************************
recordnum = -1 ;get the first item
flag = 16

list = ""
While @true
 recordnum = dbGetNextItem(handle, recordnum, flag)
 flag = 2 ;variable record number
 if recordnum == -1 then break ;Reached end of database
 if recordnum == @LAFFDBERROR
err = dbGetLastError()
   Message("Error getting next record", err)
 endif

 field = dbGetRecordField(handle, recordnum, columnname, 2)
 if field == @LAFFDBERROR
err = dbGetLastError()
   Message("Error getting record field", err)
 endif
 list = strcat(list,@tab,field)
EndWhile

list = StrTrim(list)
AskItemList("List of records in the %columnname% column", list, @tab, @unsorted, @single)

;******************************************************
;**   Closes Database handle
;******************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif
exit

See Also:

dbGetNextItembp1y0t, dbGetLastErrorbp1ycr


dbGetSaveStatus

dbGetSaveStatus

Checks if a database needs to be saved.

Syntax:

dbGetSaveStatus( handle )

Parameters:

(i) handle The handle of the database.

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError
to find out what went wrong.
0: database has not been modified since the
last load or save
1: database has been modified and needs to be saved if
you want the data in memory to match the file.

This function can be used to determine if a database needs to be saved. This function will always return 0 for valid disk-based or memory-based databases.

Example:

ret = AddExtender("laffd34i.dll")

;*********************************************************
;**   Example Database
;*********************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;*********************************************************
;**   dbOpen - open the test database
;*********************************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;*********************************************************
;**   Get a list of columns to display
;*********************************************************
columnlist = ""
count = dbGetColumnCount(handle)
For column = 1 to count
name = dbGetColumnName (handle, column)
if name ==""
 err = dbGetLastError()
    Message("Error getting column name", err)
endif
columnlist =Strcat(columnlist, @tab, name)

Next
columnlist = StrTrim(columnlist);remove leading tab

While @true ;Make sure the user selects a column
  columnname = AskItemList("Choose column to Sort", columnlist, @tab, @unsorted, @single)
  if columnname != "" then break
endwhile

;*********************************************************
;**   dbGetSaveStatus
;*********************************************************
ret = dbGetSaveStatus(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error getting saved status", err)
exit
Endif
if ret == 1
Message("dbGetSaveStatus - Before Sort","Database has been modified and needs to be saved if you want the data in memory to match the file.")
else
Message("dbGetSaveStatus - Before Sort","Database has not been modified since the last load or save.")
endif

;*********************************************************
;**   dbSort
;*********************************************************
ret = dbSort(handle, columnname, 1)
if ret == 0
err = dbGetLastError()
Message("Error sorting column", err)
exit
endif

;*********************************************************
;**   dbGetSaveStatus
;*********************************************************
ret = dbGetSaveStatus(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error getting saved status", err)
exit
Endif
if ret == 1
Message("dbGetSaveStatus - After Sort","Database has been modified and needs to be saved if you want the data in memory to match the file.")
else
Message("dbGetSaveStatus - After Sort","Database has not been modified since the last load or save.")
endif

;*********************************************************
;**   dbDebug - to view the database with the column removed
;*********************************************************
ret = dbDebug(handle)
if ret == 0
err = dbGetLastError()
Message("Error using dbDebug", err)
endif

ret = AskYesNo('Do you want to save changes to the sample database?', 'if so, please press "YES"')
if ret == @YES
saveas = AskFileName("SelectFile", "C:\Output DB", "*.*", "Sorted.csv", 0)

  ;*********************************************************
  ;**   Saves Changes
  ;*********************************************************
  ret = dbSave (handle, saveas, "")
  if ret == 0
                  err = dbGetLastError()
                  Message("Error Saving the database", err)
  endif
endif

;*********************************************************
;**   Closes Database handle
;*********************************************************
ret = dbClose(handle)
if ret == 0

err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbOpenbp1yck, dbGetLastErrorbp1ycr, dbSavebp1ycp


dbGetVersion

dbGetVersion

Returns the version number of the extender DLL.

Syntax:

dbGetVersion()

Parameters:

None

Returns:

(i) version version number of the DLL

Example:

AddExtender("laffd34i.dll")
;*************************************************
;**   dbGetVersion
;*************************************************
ver = dbGetVersion()
Message("LAFFDB Extender Version",ver)
Exit

See Also:

dbGetLastErrorbp1ycr


dbInsertColumn

dbInsertColumn

Inserts an empty column in the database.

Syntax:

dbInsertColumn (handle, column)

Parameters:

(i) handle The handle of the database.

(i/s) column The number or name of the column.

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find out what went wrong.
1: Success

Example:

ret = AddExtender("laffd34i.dll")

;*********************************************************
;**   Example Database
;*********************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;*********************************************************
;**   dbOpen - open the test database
;*********************************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;*********************************************************
;**   dbInsertColumn
;**   Insert an empty column in the database.
;*********************************************************
ret = dbInsertColumn (handle, 1)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Inserting the Column", err)
endif

;*********************************************************
;**   dbColumnName
;**   Insert an empty column in the database.
;*********************************************************
ret = dbNameColumn(handle, 1, "Test")
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Naming the Column", err)
endif

;*********************************************************
;**   dbDebug - to view the database with the column removed
;*********************************************************
ret = dbDebug(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error using dbDebug", err)
endif

ret = AskYesNo('Do you want to save changes to the sample database?', 'if so, please press "YES"')
if ret == @YES
  saveas = AskFileName("SelectFile", "C:\Output DB", "*.*", "InsertedColumn.csv", 0)
  ;*********************************************************
  ;**   Saves Changes
  ;*********************************************************
  ret = dbSave (handle, saveas, "")
  if ret == @LAFFDBERROR
                  err = dbGetLastError()
                  Message("Error Saving the database", err)
  endif
endif

;*********************************************************
;**   Closes Database handle
;*********************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbDeleteColumn , dbGetLastErrorbp1ycr


dbMakeNewItem

dbMakeNewItem

Adds a new, empty entry into the database, and returns a record number to the new item.

Syntax:

dbMakeNewItem(handle, flags)

Parameters:

(i) handle The handle of the database.

(i) flags Add together any of these values to achieve the particular goals.
Some values are exclusive, using both of them will result in an
error. If flags is zero, the bolded items will be assumed:

1: Return a fixed record number
2: Return a variable record number

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find out what went wrong.
Otherwise: The record number of the new item.

Example:

ret = AddExtender("Laffd34i.dll")

;*******************************************
;**   Example Database
;*******************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;*******************************************
;**   dbOpen - open the test database
;*******************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;*******************************************
;**   dbMakeNewItem
;*******************************************
record = dbMakeNewItem(handle, 1) ;Fixed record number
if record == @LAFFDBERROR
err = dbGetLastError()
Message("Error Making a new entry", err)
endif

;*******************************************
;**  dbSetRecordField
;**  Sets a column (field) of one record to a new value.
;*******************************************
data = "10010,Marley,Rita,33 Reggae Road,St. Ann's Parish,Jamaica,10101"
count = ItemCount(data,",")
For x = 1 to count
   value = ItemExtract(x,data,",")
ret = dbSetRecordField( handle, record, x, 1, value)  ;Fixed record number
if record == @LAFFDBERROR
   err = dbGetLastError()
   Message("Error setting record field", err)
   endif
next

;*******************************************
;**   dbDebug - to view the database with the column removed
;*******************************************
ret = dbDebug(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error using dbDebug", err)
endif

ret = AskYesNo('Do you want to save changes to the sample database?', 'if so, please press "YES"')
if ret == @YES
saveas = AskFileName("SelectFile", "C:\Output DB", "*.*", "MakeNewItem.csv", 0)
  ;*******************************************
  ;**   Saves Changes
  ;*******************************************
  ret = dbSave (handle, saveas, "")
  if ret == @LAFFDBERROR
                  err = dbGetLastError()
                  Message("Error Saving the database", err)
  endif
endif

;*******************************************
;**   Closes Database handle
;*******************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbSetRecordField , dbGetLastErrorbp1ycr


dbNameColumn

dbNameColumn

Names a column of the database with a string. This allows the programmer to refer to the column by a textual name versus a number, which leads to self-commenting code.

Syntax:

dbNameColumn(handle, columnnumber, columnname)

Parameters:

(i) handle The handle of the database.

(i) columnnumber The column number to name. The first column is
column number 1.

(s) columnname The string to name the column with.

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find out what went wrong.
1: Success.

Example:

;***************************************************
;**  Creates a Sample database, to be used in other examples
;***************************************************
AddExtender("Laffd34i.dll")

;***************************************************
;**   Example Database
;***************************************************
filename = "C:\Input DB\Sample.csv"
delimiter = ","

path = FilePath(filename)
if !DirExist(path) then DirMake(path)
if FileExist(filename) then FileDelete(filename)

;***************************************************
;**   dbOpen - create a Sample database, to be used in other examples
;***************************************************
bCreateOK = 1 ; if file does not exist, create an empty database.
model = 2     ; traditional
numcols = 7   ; number of columns
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;***************************************************
;**   Define data
;***************************************************
columnheadings = "CustID,LastName,FirstName,Address,City,State,Zip"
CustID = "1000,1001,1002,1003,1004,1005,1006,1007,1008,1009"
LastName = "Flintstone,Rubble,Flintstone,Rubble,Ball,Arnez,Boop,Dean,Monroe,Marley"
FirstName = "Fred,Barney,Wilma,Betty,Lucille,Desi,Betty,James,Marilyn,Bob"
Address = "1230 Stone Road,4560 Pebble Street,1230 Stone Road,4560 Pebble Street,55 Love Lane,55 Love Lane,1930 Boop-Boop-A-Doop Loop,1960 Desire Street,1962 Norma Jean Ave.,333 Reggae Road"
City = "BedRock,BedRock,BedRock,BedRock,TelevisionCity,TelevisionCity,Hollywood,Hollywood,Hollywood,St. Ann's Parish"
State = "AZ,AZ,AZ,AZ,CA,CA,CA,CA,CA,Jamaica"
Zip = "85000,85000,85000,85000,90201,90201,90068,90068,90068,10101"

;***************************************************
;**   Names a column of the database with a string.
;***************************************************
For columnnumber = 1 to numcols
  columnname = ItemExtract(columnnumber,columnheadings,",")
  ret = dbNameColumn(handle, columnnumber, columnname)
if ret == @LAFFDBERROR
  err = dbGetLastError()
  Message("Error Setting record field", err)
  endif
Next

;***************************************************
;**   Write data into database
;***************************************************
numrecords = 10
For  recordnum = 1 to numrecords
  ;***************************************************
  ;**   dbMakeNewItem
  ;***************************************************
     recordnum = dbMakeNewItem(handle, 1)
     if recordnum == @LAFFDBERROR
         err = dbGetLastError()
         Message("Error Making a new entry", err)
     endif

     For columnnumber = 1 to numcols
        columnname = ItemExtract(columnnumber,columnheadings,",")
        value = ItemExtract(recordnum,%columnname%,",")
        ret = dbSetRecordField(handle, recordnum, columnname, 1|4, value)
        if ret == @LAFFDBERROR
           err = dbGetLastError()
           Message("Error Setting record field", err)
        endif
     Next
Next

;***************************************************
;**   Saves Changes to database file
;***************************************************
ret = dbSave (handle, filename, "")
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Saving the database", err)
endif

;***************************************************
;**   Display contents of new database
;***************************************************
dbdebug(handle)

;***************************************************
;**   Closes Database handle
;***************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbGetColumnNamebp1ycm, dbGetLastErrorbp1ycr


dbOpen

dbOpen

Opens or Creates a database for usage by WinBatch.

Syntax:

dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)

Parameters:

(s) filename filename to open or create. For the memory-based model, this
parameter is ignored.

(i) bCreateOK Used only for Disk-based and traditional models.
0 - File MUST exist
1 - if file does not exist, create an empty database.

(i) model 0 - Disk-based
1 - Memory-Based
2 - Traditional

(i) numcols The number of columns in the database. For Memory-Based
models, this value cannot be zero.

OR

0 - will use the number of columns in the first line of the text file.
-1 - will use the number of columns in the first line of the text file,
name the columns according to the values in the first line of the
text file, and will start reading actual data on the second line of
the file.

(i) format 0 - Delimiter-based
1 - Space-separator based. If a column’s data has a space, the
column must be in quotes
2 - Fixed columns

(s) delimiter Used only if format is 0 or 2. Specifies the delimiter to use to
separate the columns. Note: the delimiter must be a low ascii character.

(s) option-string See Below.

Returns:

(i) A handle if successful, use this handle value for all
other LAFFDB functions.
@LAFFDBERROR if there was an error. Use dbGetLastError
to find out what went wrong.

Numcols

The actual number of columns in the database. For Memory-Based models, this value cannot be zero.

If this value is set to zero, LAFFDB will use the number of columns in the first line of the text file. Use dbGetColumnCount to find out how many columns were detected.

If this value is set to -1, LAFFDB will use the number of columns in the first line of the text file, name the columns according to the values in the first line of the text file, and will start reading actual data on the second line of the file. Use dbGetColumnCount to find out how many columns were detected. Use dbGetColumnName to find out the names of the columns.

Option-String

If the model is traditional (2) or disk-based (0), then the option-string value is only used if the format value is 2 (fixed columns). In that case, option-string is a string of numerical values that specify the number of characters per field, each separated by a space.

For example, if the first column was four characters, and second column
was 12 characters, and the third column was 6 characters, optionstring
would be set to the value of  “4 12 6”

If the model is memory-based (1), then this string specifies the maximum string size for each column. If the value is 0, then the maximum string size is 65535 characters.

For example, if the database to create was the "SSIFS" example as cited in the datatypestring parameter, and optionstring was "4 12 0 0 34", then column 1 would be at maximum four bytes, and column 2 would be at maximum 12 bytes. Columns 3 and 4 are up to 65535 characters. Column 5 would be a maximum of 34 bytes.

If the model is memory-based, and this string is left blank, then each column string can be up to 65536 characters.

Example:

;****************************************************
;**  Creates a Sample database, to be used in other examples
;****************************************************
AddExtender("Laffd34i.dll")

;****************************************************
;**   Example Database
;****************************************************
filename = "C:\Input DB\Sample.csv"
delimiter = ","

path = FilePath(filename)
if !DirExist(path) then DirMake(path)
if FileExist(filename) then FileDelete(filename)

;****************************************************
;**   dbOpen - create a Sample database, to be used in other examples
;****************************************************
bCreateOK = 1 ; if file does not exist, create an empty database.
model = 2     ; traditional
numcols = 7   ; number of columns
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;****************************************************
;**   Define data
;****************************************************
columnheadings = "CustID,LastName,FirstName,Address,City,State,Zip"
CustID = "1000,1001,1002,1003,1004,1005,1006,1007,1008,1009"
LastName = "Flintstone,Rubble,Flintstone,Rubble,Ball,Arnez,Boop,Dean,Monroe,Marley"
FirstName = "Fred,Barney,Wilma,Betty,Lucille,Desi,Betty,James,Marilyn,Bob"
Address = "1230 Stone Road,4560 Pebble Street,1230 Stone Road,4560 Pebble Street,55 Love Lane,55 Love Lane,1930 Boop-Boop-A-Doop Loop,1960 Desire Street,1962 Norma Jean Ave.,333 Reggae Road"
City = "BedRock,BedRock,BedRock,BedRock,TelevisionCity,TelevisionCity,Hollywood,Hollywood,Hollywood,St. Ann's Parish"
State = "AZ,AZ,AZ,AZ,CA,CA,CA,CA,CA,Jamaica"
Zip = "85000,85000,85000,85000,90201,90201,90068,90068,90068,10101"

;****************************************************
;**   Names a column of the database with a string.
;****************************************************
For columnnumber = 1 to numcols
  columnname = ItemExtract(columnnumber,columnheadings,",")
  ret = dbNameColumn(handle, columnnumber, columnname)
if ret == @LAFFDBERROR
  err = dbGetLastError()
  Message("Error Setting record field", err)
  endif
Next

;****************************************************
;**   Write data into database
;****************************************************
numrecords = 10
For  recordnum = 1 to numrecords
;****************************************************
;**   dbMakeNewItem
;****************************************************
recordnum = dbMakeNewItem(handle, 1)
if recordnum == @LAFFDBERROR
  err = dbGetLastError()
  Message("Error Making a new entry", err)
endif

For columnnumber = 1 to numcols
  columnname = ItemExtract(columnnumber,columnheadings,",")
  value = ItemExtract(recordnum,%columnname%,",")
  ret = dbSetRecordField(handle, recordnum, columnname, 1|4, value)
if ret == @LAFFDBERROR
  err = dbGetLastError()
  Message("Error Setting record field", err)
  endif
     Next
Next

;****************************************************
;**   Saves Changes to database file
;****************************************************
ret = dbSave (handle, filename, "")
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Saving the database", err)
endif

;****************************************************
;**   Display contents of new database
;****************************************************
dbdebug(handle)

;****************************************************
;**   Closes Database handle
;****************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbClose , dbGetLastErrorbp1ycr , dbSetOptionsInd8j2.98


dbSave

dbSave

Writes the information from a database to a disk file. This function will work for all models.

Syntax:

dbSave (handle, alternatefilename, backupfilename)

Parameters:

(i) handle The handle of the database.

(s) alternatefilename Leave empty (“”) if saving to the same filename that was used in
dbOpen. If the model is memory-based, then this value must be
specified with a valid filename.

(s) backupfilename Leave empty to avoid making a backup of the file. Specify a
backup filename to make a backup of the existing disk file before
writing out the current database.

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find
out what went wrong.
1: Success.

Note: dbSave will fail with backup file option, if backup file name already exists.

Example:

;*****************************************************
;**  Creates a Sample database, to be used in other examples
;*****************************************************
AddExtender("Laffd34i.dll")

;*****************************************************
;**   Example Database
;*****************************************************
filename = "C:\Input DB\Sample.csv"
delimiter = ","

path = FilePath(filename)
if !DirExist(path) then DirMake(path)
if FileExist(filename) then FileDelete(filename)

;*****************************************************
;**   dbOpen - create a Sample database, to be used in other examples
;*****************************************************
bCreateOK = 1 ; if file does not exist, create an empty database.
model = 2     ; traditional
numcols = 7   ; number of columns
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;*****************************************************
;**   Define data
;*****************************************************
columnheadings = "CustID,LastName,FirstName,Address,City,State,Zip"
CustID = "1000,1001,1002,1003,1004,1005,1006,1007,1008,1009"
LastName = "Flintstone,Rubble,Flintstone,Rubble,Ball,Arnez,Boop,Dean,Monroe,Marley"
FirstName = "Fred,Barney,Wilma,Betty,Lucille,Desi,Betty,James,Marilyn,Bob"
Address = "1230 Stone Road,4560 Pebble Street,1230 Stone Road,4560 Pebble Street,55 Love Lane,55 Love Lane,1930 Boop-Boop-A-Doop Loop,1960 Desire Street,1962 Norma Jean Ave.,333 Reggae Road"
City = "BedRock,BedRock,BedRock,BedRock,TelevisionCity,TelevisionCity,Hollywood,Hollywood,Hollywood,St. Ann's Parish"
State = "AZ,AZ,AZ,AZ,CA,CA,CA,CA,CA,Jamaica"
Zip = "85000,85000,85000,85000,90201,90201,90068,90068,90068,10101"

;*****************************************************
;**   Names a column of the database with a string.
;*****************************************************
For columnnumber = 1 to numcols
  columnname = ItemExtract(columnnumber,columnheadings,",")
  ret = dbNameColumn(handle, columnnumber, columnname)
if ret == @LAFFDBERROR
  err = dbGetLastError()
  Message("Error Setting record field", err)
  endif
Next

;*****************************************************
;**   Write data into database
;*****************************************************
numrecords = 10
For  recordnum = 1 to numrecords
;*****************************************************
;**   dbMakeNewItem
;*****************************************************
recordnum = dbMakeNewItem(handle, 1)
if recordnum == @LAFFDBERROR
err = dbGetLastError()
Message("Error Making a new entry", err)
endif

For columnnumber = 1 to numcols
  columnname = ItemExtract(columnnumber,columnheadings,",")
  value = ItemExtract(recordnum,%columnname%,",")
  ret = dbSetRecordField(handle, recordnum, columnname, 1|4, value)
  if ret == @LAFFDBERROR
     err = dbGetLastError()
     Message("Error Setting record field", err)
  endif
     Next
Next

;*****************************************************
;**   Saves Changes to database file
;*****************************************************
ret = dbSave (handle, filename, "")
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Saving the database", err)
endif

;*****************************************************
;**   Display contents of new database
;*****************************************************
dbdebug(handle)

;*****************************************************
;**   Closes Database handle
;*****************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif
Exit

See Also:

dbOpenbp1yck, dbClose , dbGetLastErrorbp1ycr, dbGetSaveStatusbp1y.t


dbSetDelimiter

dbSetDelimiter

Changes the delimiter for the database disk file.

Syntax:

dbSetDelimiter (handle, delimiter)

Parameters:

(i) handle The handle of the database.

(s) delimiter The new delimiter (one character only). Note: the delimiter must be a low ascii character.

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find
out what went wrong.
1 - Success

Example:

ret = AddExtender("Laffd34i.dll")
;*******************************************************
;**   dbGetVersion
;*******************************************************
ver = dbGetVersion()
message("LAFFDB Extender Version",ver)

;*******************************************************
;**   Example Database
;*******************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;*******************************************************
;**   dbOpen - open the test database
;*******************************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;*******************************************************
;**   dbSetDelimiter
;*******************************************************
ret = dbSetDelimiter (handle, @TAB)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error setting the delimiter", err)
endif

;*******************************************************
;**   dbDebug - to view the database with the column removed
;*******************************************************
ret = dbDebug(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error using dbDebug", err)
endif

ret = AskYesNo('Do you want to save changes to the sample database?', 'if so, please press "YES"')
if ret == @YES
saveas = AskFileName("SelectFile", "C:\Output DB", "*.*", "TabDelimited.txt", 0)
  ;*******************************************************
  ;**   Saves Changes
  ;*******************************************************
  ret = dbSave (handle, saveas, "")
  if ret == @LAFFDBERROR
                  err = dbGetLastError()
                  Message("Error Saving the database", err)
  endif
endif

;*******************************************************
;**   Closes Database handle
;*******************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbSave , dbGetLastErrorbp1ycr


dbSetOptions

dbSetOptions

Set dynamic options for the database. These options can be changed at any time while the database is open.

Syntax:

dbSetOptions( handle, offset, rsvd, rsvd, rsvd)

Parameters:

(i) handle The handle of the database.
(i) offset The offset index for the columns.
0 = First column is zero
1 = first column is one.
(i) rsvd Reserved, must be zero
(i) rsvd Reserved, must be zero
(i) rsvd Reserved, must be zero

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find
out what went wrong.
1: Success

By default, the columns are 1-based in the indexing.

Example:

AddExtender("Laffd34i.dll")

;*******************************************************
;**   Example Database
;*******************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
  exit
Endif

;*******************************************************
;**   dbOpen - open the test database
;*******************************************************
bCreateOK = 0 ;File MUST exist
model = 2  ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
   Message("Error Opening the database specified", err)
   exit
Endif

;*******************************************************
;**   dbSetOption - set offset index for the columns
;**
;**                Change traditonal models offset index
;**                for the columns, from 1 to 0. Now the first
;**                column will be referenced by 0.
;**
;*******************************************************
ret = dbSetOptions(handle,0,0,0,0)
if ret == @LAFFDBERROR
   err = dbGetLastError()
   Message("Error setting offset index for the columns", err)
   exit
endif
Message("dbSetOptions", "Offset index for the columns is now zero")

;*******************************************************
;**   Get a list of columns to display
;*******************************************************
columnlist = ""
count = dbGetColumnCount(handle)
For column = 0 to count-1                 ;<<< column offset is now zero
   name = dbGetColumnName (handle, column)
   if name ==""
      err = dbGetLastError()
      Message("Error getting column name", err)
   endif
   columnlist =Strcat(columnlist, @tab, name)
Next
columnlist = StrTrim(columnlist);remove leading tab
columnname = AskItemList("Column list - offset index of 0", columnlist, @tab, @unsorted, @single)

;*******************************************************
;**   Get the column number of column name chosen
;*******************************************************
columnnumber = dbGetColumnNumber( handle, columnname )
if columnnumber == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Getting Column Number", err)
exit
Endif
Message(StrCat("Column number of a named column: ",columnname),columnnumber)

;*******************************************************
;**   Closes Database handle
;*******************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
   err = dbGetLastError()
  Message("Error Closing the database", err)
endif
exit

See Also:

dbOpenbp1yck, dbSavebp1ycp, dbGetLastErrorbp1ycr


dbSetEntireRecord

dbSetEntireRecord

Adds or modifies an entire row of data from WIL variables as previously defined with the dbBindCol functon. If the row of data contains columns not defined by a previous dbBindCol, then those columns are set to a blank string, 0, or 0.0 depending on column type.

Syntax:

dbSetEntireRecord(handle, recordnum, flags)

Parameters:

(i) handle The handle of the database.

(i) recordnum The record number of the item.

(i) flags Add together any of these values to achieve the particular goals.
Some values are exclusive, using both of them will result in an
error. If flags is zero, the bolded items will be assumed:

1: recordnum is a fixed record number
2: recordnum is a variable record number
4: Add a new item (ignore recordnum)
8: Return a fixed record number
16: return a variable record number
32: Require all columns to be bound with dbBindCol

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find
out what went wrong.
Otherwise: The record number of the new item.

Example:

ret = AddExtender("Laffd34i.dll")

;****************************************************
;**   Example Database
;****************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;****************************************************
;**   dbOpen - open the test database
;****************************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

columnheadings = "CustID,LastName,FirstName,Address,City,State,Zip"
values = "1010,Marley,Rita,333 Reggae Road,St. Ann's Parish,Jamaica,10101"
For x = 1 to ItemCount(columnheadings,",")
  var = ItemExtract(x,columnheadings,",")
ret = dbBindCol(handle,x,var)
if ret == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif
%var% = ItemExtract(x,values,",")
Next

ret = dbSetEntireRecord(handle, 10, 4|8) ;Add a new item
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error getting entire record", err)
endif

;****************************************************
;**   dbDebug - to view the database with the Cloned Record
;****************************************************
ret = dbDebug(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error using dbDebug", err)
endif

ret = AskYesNo('Do you want to save changes to the sample database?', 'if so, please press "YES"')
if ret == @YES
saveas = AskFileName("SelectFile", "C:\Output DB", "*.*", "AddedNewRecord.csv", 0)
  ;****************************************************
  ;**   Saves Changes
  ;****************************************************
  ret = dbSave (handle, saveas, "")
  if ret == @LAFFDBERROR
                  err = dbGetLastError()
                  Message("Error Closing the database", err)
  endif
endif

;****************************************************
;**   Closes Database handle
;****************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbBindCol , dbGetLastErrorbp1ycr


dbSetErrorReporting

dbSetErrorReporting

Allows quick and easy debugging of the LAFFDB functions.

Syntax:

dbSetErrorReporting ( title, flag)

Parameters:

(s) title title of error messages.
(i) flag see below.

flag = 0: Call dbGetLastError to capture errors (default)

flag = 1: Display any errors generated at the completion of any function call. The error log will NOT be cleared, and the functions will still return failure codes in the event of trouble. Your code still must clear the log with dbGetLastError. The reason for this is to keep debuild/release WinBatch scripts identical.

In general, you want to set the flag to 0 for release builds, and 1 for debugging.

Example:

AddExtender("laffd34i.dll")
flag = 1
ret = dbSetErrorReporting ("LAFFDB Auto Error Reporting",flag)

See Also:

dbGetLastErrorbp1ycr,


dbSetRecordField

dbSetRecordField

Sets a column (field) of one record to a new value.

Syntax:

dbSetRecordField(handle, recordnum, column, flags, value)

Parameters:

(i) handle The handle of the database.

(i) recordnum The record number of the item.

(i/s) column The number or name of the column.

(i) flags Add together any of these values to achieve the particular goals.
Some values are exclusive, using both of them will result in an
error. If flags is zero, the bolded items will be assumed:

1: recordnum is a fixed record number
2: recordnum is a variable record number
4: Generate an error if the new string data is too long to fit in the
column (if the column width is specified). If this flag is not set, the
data would be truncated to fit.

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find
out what went wrong.
1 - Success.

Example:

;******************************************************
;**  Creates a Sample database, to be used in other examples
;******************************************************
AddExtender("laffd34i.dll")

;******************************************************
;**   Example Database
;******************************************************
filename = "C:\Input DB\Sample.csv"
delimiter = ","

path = FilePath(filename)
if !DirExist(path) then DirMake(path)
if FileExist(filename) then FileDelete(filename)

;******************************************************
;**   dbOpen - create a Sample database, to be used in other examples
;******************************************************
bCreateOK = 1 ; if file does not exist, create an empty database.
model = 2     ; traditional
numcols = 7   ; number of columns
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;******************************************************
;**   Define data
;******************************************************
columnheadings = "CustID,LastName,FirstName,Address,City,State,Zip"
CustID = "1000,1001,1002,1003,1004,1005,1006,1007,1008,1009"
LastName = "Flintstone,Rubble,Flintstone,Rubble,Ball,Arnez,Boop,Dean,Monroe,Marley"
FirstName = "Fred,Barney,Wilma,Betty,Lucille,Desi,Betty,James,Marilyn,Bob"
Address = "1230 Stone Road,4560 Pebble Street,1230 Stone Road,4560 Pebble Street,55 Love Lane,55 Love Lane,1930 Boop-Boop-A-Doop Loop,1960 Desire Street,1962 Norma Jean Ave.,333 Reggae Road"
City = "BedRock,BedRock,BedRock,BedRock,TelevisionCity,TelevisionCity,Hollywood,Hollywood,Hollywood,St. Ann's Parish"
State = "AZ,AZ,AZ,AZ,CA,CA,CA,CA,CA,Jamaica"
Zip = "85000,85000,85000,85000,90201,90201,90068,90068,90068,10101"

;******************************************************
;**   Names a column of the database with a string.
;******************************************************
For columnnumber = 1 to numcols
  columnname = ItemExtract(columnnumber,columnheadings,",")
  ret = dbNameColumn(handle, columnnumber, columnname)
if ret == @LAFFDBERROR
  err = dbGetLastError()
  Message("Error Setting record field", err)
  endif
Next

;******************************************************
;**   Write data into database
;******************************************************
numrecords = 10
For  recordnum = 1 to numrecords
  ;******************************************************
  ;**   dbMakeNewItem
  ;******************************************************
  recordnum = dbMakeNewItem(handle, 1)
  if recordnum == @LAFFDBERROR
      err = dbGetLastError()
      Message("Error Making a new entry", err)
  endif

  For columnnumber = 1 to numcols
      columnname = ItemExtract(columnnumber,columnheadings,",")
      value = ItemExtract(recordnum,%columnname%,",")
      ret = dbSetRecordField(handle, recordnum, columnname, 1|4, value)
      if ret == @LAFFDBERROR
  err = dbGetLastError()
  Message("Error Setting record field", err)
     endif
   Next
Next

;******************************************************
;**   Saves Changes to database file
;******************************************************
ret = dbSave (handle, filename, "")
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Saving the database", err)
endif

;******************************************************
;**   Display contents of new database
;******************************************************
dbdebug(handle)

;******************************************************
;**   Closes Database handle
;******************************************************
ret = dbClose(handle)
if ret == @LAFFDBERROR
err = dbGetLastError()
Message("Error Closing the database", err)
endif
Exit

See Also:

dbMakeNewItem , dbGetLastErrorbp1ycr


dbSort

dbSort

Sorts the database by one column. When two comparison fields are identical, their original order is retained so that successive sorts on more than one column would preserve the sort order of previous sorts where applicable.

Syntax:

dbSort (handle, column, order)

Parameters:

(i) handle The handle of the database.

(i/s) column The number or name of the column.

(i) order 0 - Sort descending
1 - Sort ascending

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find
out what went wrong.
1 - Success.

Note: For a multi-column sort, simply sort the database by the least significant column first, then add additional sorts for more significant columns. Since the previous sort order is preserved with each sort where comparision fields are identical.

Text field sorts are done via the ANSI collating sequence, also known as a "Dictionary" sort. The text strings will appear in the same (or reverse) order that they would appear in a dictionary.

Example:

ret = AddExtender("laffd34i.dll")

;*********************************************************
;**   Example Database
;*********************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;*********************************************************
;**   dbOpen - open the test database
;*********************************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;*********************************************************
;**   Get a list of columns to display
;*********************************************************
columnlist = ""
count = dbGetColumnCount(handle)
For column = 1 to count
name = dbGetColumnName (handle, column)
if name ==""
 err = dbGetLastError()
    Message("Error getting column name", err)
endif
columnlist =Strcat(columnlist, @tab, name)
Next
columnlist = StrTrim(columnlist);remove leading tab

While @true ;Make sure the user selects a column
  columnname = AskItemList("Choose column to Sort", columnlist, @tab, @unsorted, @single)
  if columnname != "" then break
endwhile

;*********************************************************
;**   dbSort
;*********************************************************
ret = dbSort(handle, columnname, 1)
if ret == 0
err = dbGetLastError()
Message("Error sorting column", err)
endif

;*********************************************************
;**   dbDebug - to view the database with the column removed
;*********************************************************
ret = dbDebug(handle)
if ret == 0
err = dbGetLastError()
Message("Error using dbDebug", err)
endif

ret = AskYesNo('Do you want to save changes to the sample database?', 'if so, please press "YES"')
if ret == @YES
saveas = AskFileName("SelectFile", "C:\Output DB", "*.*", "Sorted.csv", 0)
  ;*********************************************************
  ;**   Saves Changes
  ;*********************************************************
  ret = dbSave (handle, saveas, "")
  if ret == 0
                  err = dbGetLastError()
                  Message("Error Saving the database", err)
  endif
endif

;*********************************************************
;**   Closes Database handle
;*********************************************************
ret = dbClose(handle)
if ret == 0
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbSave , dbGetLastErrorbp1ycr


dbSwapColumns

dbSwapColumns

Swaps two columns in a database.

Syntax:

dbSwapColumns (handle, column1, column2)

Parameters:

(i) handle The handle of the database.

(i/s) column1 The name or number of the first column.

(i/s) column2 The name or number of the second column.

Returns:

(i) @LAFFDBERROR: Error. Use dbGetLastError to find
out what went wrong.
1: Success

Example:

ret = AddExtender("Laffd34i.dll")

;****************************************************
;**   Example Database
;****************************************************
filename = "c:\Input DB\Sample.csv"
delimiter = ","
if !FileExist(filename)
  str = "Make sure the database exists before attempting to run this example."
  str2 = "See the dbOpen example in this help file, it will create the example database for you."
  Message("Database doesn't exist", StrCat(str, @CRLF,str2))
exit
Endif

;****************************************************
;**   dbOpen - open the test database
;****************************************************
bCreateOK = 0 ;File MUST exist
model = 2     ;Traditional
numcols = -1  ;Number of columns match first line, names them, starts reading at 2nd line
format = 0
optionstring = ""
handle = dbOpen (filename, bCreateOK, model, numcols, format, delimiter, optionstring)
if handle == @LAFFDBERROR
   err = dbGetLastError()
Message("Error Opening the database specified", err)
exit
Endif

;****************************************************
;**   Get a list of columns to display
;****************************************************
columnlist = ""
count = dbGetColumnCount(handle)
For column = 1 to count
name = dbGetColumnName (handle, column)
if name ==""
 err = dbGetLastError()
    Message("Error getting column name", err)
endif
columnlist =Strcat(columnlist, @tab, name)
Next
columnlist = StrTrim(columnlist);remove leading tab

While @true ;Make sure the user selects a column
  columnname = AskItemList("Choose two columns to swap", columnlist, @tab, @unsorted, @Multiple)
  if itemcount(columnname,@TAB) == 2 then break ;Make sure two columns selected
if columnname != "" then break
endwhile

;****************************************************
;**   dbSwapColumns
;****************************************************
column1 = ItemExtract(1,columnname,@tab)
column2 = ItemExtract(2,columnname,@tab)
ret = dbSwapColumns (handle, column1, column2)
if ret == 0
err = dbGetLastError()
Message("Error sorting column", err)
endif

;****************************************************
;**   dbDebug - to view the database with the column removed
;****************************************************
ret = dbDebug(handle)
if ret == 0
err = dbGetLastError()
Message("Error using dbDebug", err)
endif

ret = AskYesNo('Do you want to save changes to the sample database?', 'if so, please press "YES"')
if ret == @YES
saveas = AskFileName("SelectFile", "C:\Output DB", "*.*", "Swaped.csv", 0)
  ;****************************************************
  ;**   Saves Changes
  ;****************************************************
  ret = dbSave (handle, saveas, "")
  if ret == 0
                  err = dbGetLastError()
                  Message("Error Saving the database", err)
  endif
endif

;****************************************************
;**   Closes Database handle
;****************************************************
ret = dbClose(handle)
if ret == 0
err = dbGetLastError()
Message("Error Closing the database", err)
endif

Exit

See Also:

dbSave , dbGetLastErrorbp1ycr


LAFFDB Error Strings

10000 "dbOpen: ""%s"" is an invalid filename, for the
following reason:" "    %s"
10002 "dbOpen: Invalid model."
10003 "dbOpen: Invalid columns."
10004 "dbOpen: Invalid format."
10005 "dbOpen: Invalid Delimiter."
10006 "(Warning) dbOpen: Delimiter ignored."
10007 "dbOpen: Invalid OptionString."
10008 "dbOpen: Out Of Memory." "dbOpen: Maximum number of Databases already open." "File not found"

11000 "dbClose: Invalid Handle (%s)."

12000 "dbSave: Invalid Handle (%s)." "dbSave: %s is in invalid Alternate File Name."
12002 "dbSave: %s is in invalid Backup File Name." "dbSave: Writing to alternate file %s failed.
Perhaps the disk is full or write protected." "dbSave: Backing up to %s failed. Perhaps the disk
is full or write protected."
12005 "dbSave: Writing to %s failed. Perhaps the disk is
full or write protected." "dbSave: This database is a Memory Model database.
You *must* specify an alternate filename to save
the data to." "dbNameColumn: Invalid Handle (%s)."
13001 "dbNameColumn: Invalid column number."
13002 "dbNameColumn: Invalid name." "(Warning) dbNameColumn: Column Name too long--
Truncating to 128 characters."
13004 "dbNameColumn: Column name (%s) already in use
for a different column." "dbGetColumnType: Invalid Handle (%s)." "dbGetColumnType: %s is not a column in use."
14002 "dbGetColumnType: ""%s"" is not any of the columns' names." "dbGetColumnName: Invalid Handle (%s)." "dbGetColumnName: %s is not a column in use." "dbGetRecordCount: Invalid Handle (%s)."

18000 "dbGetColumnCount: Invalid Handle (%s)."

19000 "dbBindCol: Invalid Handle (%s)."
19001 "dbBindCol: %s is not a column in use." "dbBindCol: ""%s"" is not any of the columns' names."
19003 "dbBindCol: %s is not a valid WIL Variable." "dbSort: Invalid Handle (%s)"
20001 "dbSort: %s is not a column in use." "dbSort: ""%s"" is not any of the columns' names." "dbSort: Invalid order."

21000 "dbGetNextItem: Invalid Handle (%s)."
21001 "dbGetNextItem: Invalid record number."
21002 "dbGetNextItem: Invalid flags." "dbGetNextItem: Flags 1 and 2 are exclusive."
21004 "dbGetNextItem: Flags 4 and 8 are exclusive."
21005 "dbGetNextItem: Flags 16 and 32 are exclusive." "dbMakeNewItem: Invalid Handle (%s)."
22001 "dbMakeNewItem: Invalid Flags." "dbMakeNewItem: Flags 1 and 2 are exclusive."
22003 "dbMakeNewItem: Internal Failure. Probably
Out Of Memory." "dbSetRecordField: Invalid Handle (%s)."
23001 "dbSetRecordField: Invalid record number."
23002 "dbSetRecordField: Invalid Flags." "dbSetRecordField: Flags 1 and 2 are exclusive."
23004 "dbSetRecordField: String Too Long. Column %s characters"
23005 "dbSetRecordField: %s is not a column in use." "dbSetRecordField: ""%s"" is not any of the
columns' names." "dbGetRecordField: Invalid Handle (%s)."
24001 "dbGetRecordField: Invalid record number." "dbGetRecordField: %s is not a column in use." "dbGetRecordField: ""%s"" is not any of the
columns' names." "dbGetRecordField: Invalid Flags." "dbGetRecordField: Flags 1 and 2 are exclusive." "dbGetRecordField: Internal Failure. Probably
Out Of Memory." "dbGetEntireRecord: Invalid Handle (%s)." "dbGetEntireRecord: Invalid record number." "dbGetEntireRecord: Invalid Flags." "dbGetEntireRecord: Flags 1 and 2 are exclusive." "dbGetEntireRecord: Internal Failure. Probably
Out Of Memory."
25005 "dbGetEntireRecord: Due to flag 4, all of the
fields need to be bound with dbBindCol." "dbSetEntireRecord: Invalid Handle (%s)." "dbSetEntireRecord: Invalid record number." "dbSetEntireRecord: Invalid Flags." "dbSetEntireRecord: Flags 1 and 2 are exclusive."
26004 "dbSetEntireRecord: Flags 8 and 16 are exclusive." "dbSetEntireRecord: Internal Failure. Probably
Out Of Memory."
26006 "dbGetEntireRecord: Due to flag 32, all of
the fields need to be bound with dbBindCol." "dbDeleteRecord: Invalid Handle (%s)."
27001 "dbDeleteRecord: Invalid record number."
27002 "dbDeleteRecord: Invalid Flags." "dbDeleteRecord: Flags 1 and 2 are exclusive." "dbCloneRecord: Invalid Handle (%s)."
28001 "dbCloneRecord: Invalid record number."
28002 "dbCloneRecord: Invalid Flags." "dbCloneRecord: Flags 1 and 2 are exclusive."
28004 "dbCloneRecord: Flags 4 and 32 are exclusive."
28005 "dbCloneRecord: Flags 8 and 16 are exclusive."
28006 "dbCloneRecord: Internal Failure. Probably
Out Of Memory." "dbFindRecord: Invalid Handle (%s)."
29001 "dbFindRecord: Invalid record number."
29002 "dbFindRecord: Invalid Flags."
29003 "dbFindRecord: %s is not a column in use." "dbFindRecord: ""%s"" is not any of the
columns' names." "dbFindRecord: Invalid find value."
29006 "dbFindRecord: Invalid match case." "dbFindRecord: Flags 1 and 2 are exclusive."
29008 "dbFindRecord: Flags 4 and 8 are exclusive." "dbDebug: Invalid Handle (%s)."
"\r\n%d Errors were not logged because there
were too many Errors." "dbCookDatabases: ""%s"" is an invalid filename,
for the following reason:" "    %s"
32002 "dbCookDatabases: Invalid model."
32003 "dbCookDatabases: Invalid columns."
32004 "dbCookDatabases: Invalid format."
32005 "dbCookDatabases: Invalid Delimiter." "(Warning) dbCookDatabases: Delimiter ignored." "dbCookDatabases: Invalid OptionString."
32008 "dbCookDatabases: Out Of Memory." "dbCookDatabases: Maximum number of Databases
already open." "dbCookDatabases: InvalidHandleA"
32011 "dbCookDatabases: InvalidHandleB"
32012 "dbCookDatabases: InvalidOperation"
32013 "dbCookDatabases: InvalidFlags"
32014 "dbCookDatabases: InvalidColumnLayout"
32015 "dbCookDatabases: InvalidMatchingCriteria" "dbCookDatabases: File ""%s"" already exists.
The new database to be created would overwrite
it. Please delete the file or use a different
name." "dbDeleteColumn: InvalidHandle (%s)"
33001 "dbDeleteColumn: InvalidColumn %ld"
33002 "dbDeleteColumn: InvalidColumn %s"

34000 "dbInsertColumn: InvalidHandle (%s)"
34001 "dbInsertColumn: InvalidColumn %ld"
34002 "dbInsertColumn: InvalidColumn %s"

35000 "dbSwapColumns: InvalidHandle (%s)"
35001 "dbSwapColumns: InvalidColumn 1 %ld"
35002 "dbSwapColumns: InvalidColumn 2 %s"
35003 "dbSwapColumns: InvalidColumn 1 %ld"
35004 "dbSwapColumns: InvalidColumn 2 %s" "dbSwapColumns: Both column values passed in
are for the same column." "dbSetDelimiter: InvalidHandle (%s)"
36001 "dbSetDelimiter: Invalid Delimiter"

Ÿ Mainkp1yckŸ Complete Function Listcon..fqwe