summaryrefslogtreecommitdiff
path: root/src/examples/xb_ex_v4_create_dbf.cpp
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2023-01-29 15:45:51 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2023-01-29 15:45:51 +0100
commit517ad9d4b6eae320b708d03a9340a22893b0cab7 (patch)
tree37cf1907008821b4155cf90718b8d7b00a9d3461 /src/examples/xb_ex_v4_create_dbf.cpp
parent4875a3dd9b183dcd2256e2abfc4ccf7484c233b4 (diff)
New upstream version 4.0.3upstream/4.0.3
Diffstat (limited to 'src/examples/xb_ex_v4_create_dbf.cpp')
-rwxr-xr-xsrc/examples/xb_ex_v4_create_dbf.cpp42
1 files changed, 30 insertions, 12 deletions
diff --git a/src/examples/xb_ex_v4_create_dbf.cpp b/src/examples/xb_ex_v4_create_dbf.cpp
index a2aff74..6169213 100755
--- a/src/examples/xb_ex_v4_create_dbf.cpp
+++ b/src/examples/xb_ex_v4_create_dbf.cpp
@@ -13,6 +13,11 @@ Email Contact:
This example demonstrates the creation of a Version IV file and and indices
+ Creates three files in folder "PROJECT_DATA_DIR"
+ Address.DBF - Table with all the data
+ Address.DBT - Memo (variable lenght char field) data
+ Address.MDX - File with index data
+
*/
#include <xbase.h>
@@ -24,18 +29,27 @@ int main()
#ifdef XB_DBF4_SUPPORT
- xbSchema MyRecord[] =
+ xbSchema MyAddressBookRecord[] =
{
- { "FIRSTNAME", XB_CHAR_FLD, 15, 0 },
{ "LASTNAME", XB_CHAR_FLD, 20, 0 },
+ { "FIRSTNAME", XB_CHAR_FLD, 15, 0 },
+ { "COMPANY", XB_CHAR_FLD, 20, 0 },
+ { "ADDRESS", XB_CHAR_FLD, 35, 0 },
+ { "CITY", XB_CHAR_FLD, 30, 0 },
+ { "STATECD", XB_CHAR_FLD, 2, 0 },
+ { "ZIPCD", XB_CHAR_FLD, 10, 0 },
+
{ "BIRTHDATE", XB_DATE_FLD, 8, 0 },
- { "AMOUNT", XB_NUMERIC_FLD, 9, 2 },
- { "RETIRED?", XB_LOGICAL_FLD, 1, 0 },
- { "ZIPCODE", XB_NUMERIC_FLD, 5, 0 },
- { "NUMFLD1", XB_FLOAT_FLD, 12, 2 },
- { "NUMFLD2", XB_FLOAT_FLD, 14, 2 },
+
+ { "AMOUNT1", XB_NUMERIC_FLD, 9, 2 },
+ { "AMOUNT2", XB_FLOAT_FLD, 12, 2 },
+
+ { "FRIEND?", XB_LOGICAL_FLD, 1, 0 },
+ { "FAMILY?", XB_LOGICAL_FLD, 1, 0 },
+ { "BUSASSOC?", XB_LOGICAL_FLD, 1, 0 },
+
#ifdef XB_MEMO_SUPPORT
- { "MEMO1", XB_MEMO_FLD, 10, 0 },
+ { "NOTES", XB_MEMO_FLD, 10, 0 },
#endif
{ "",0,0,0 }
};
@@ -46,11 +60,15 @@ int main()
xbInt16 iRc;
xbDbf * MyDbfFile;
+
+ #ifdef XB_MDX_SUPPORT
xbIx *pIx;
void *pTag;
+ #endif // XB_MDX_SUPPORT
+
MyDbfFile = new xbDbf4( &x );
- if(( iRc = MyDbfFile->CreateTable( "MyV4Table1", "MyV4TableAlias", MyRecord, XB_OVERLAY, XB_MULTI_USER )) != XB_NO_ERROR )
+ if(( iRc = MyDbfFile->CreateTable( "Address.DBF", "Address", MyAddressBookRecord, XB_OVERLAY, XB_MULTI_USER )) != XB_NO_ERROR )
x.DisplayError( iRc );
else
{
@@ -64,11 +82,11 @@ int main()
*/
// std::cout << "Creating three index tags\n";
- if(( iRc = MyDbfFile->CreateTag( "MDX", "NAME_TAG", "LASTNAME+FIRSTNAME", ".NOT. DELETED()", 0, 0, XB_OVERLAY, &pIx, &pTag )) != XB_NO_ERROR )
+ if(( iRc = MyDbfFile->CreateTag( "MDX", "NAME", "LASTNAME+FIRSTNAME", ".NOT. DELETED()", 0, 0, XB_OVERLAY, &pIx, &pTag )) != XB_NO_ERROR )
x.DisplayError( iRc );
- if(( iRc = MyDbfFile->CreateTag( "MDX", "BDDATE_TAG", "BIRTHDATE", "", 0, 0, XB_OVERLAY, &pIx, &pTag )) != XB_NO_ERROR )
+ if(( iRc = MyDbfFile->CreateTag( "MDX", "BDDATE", "BIRTHDATE", ".NOT. DELETED()", 0, 0, XB_OVERLAY, &pIx, &pTag )) != XB_NO_ERROR )
x.DisplayError( iRc );
- if(( iRc = MyDbfFile->CreateTag( "MDX", "ZIP_TAG", "ZIPCODE", "", 0, 0, XB_OVERLAY, &pIx, &pTag )) != XB_NO_ERROR )
+ if(( iRc = MyDbfFile->CreateTag( "MDX", "COMPANY", "COMPANY+LASTNAME+FIRSTNAME", ".NOT. DELETED()", 0, 0, XB_OVERLAY, &pIx, &pTag )) != XB_NO_ERROR )
x.DisplayError( iRc );
#endif // XB_MDX_SUPPORT