diff options
Diffstat (limited to 'src/examples/xb_ex_v3_create_dbf.cpp')
-rwxr-xr-x | src/examples/xb_ex_v3_create_dbf.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/examples/xb_ex_v3_create_dbf.cpp b/src/examples/xb_ex_v3_create_dbf.cpp index ecfcd72..d6f7047 100755 --- a/src/examples/xb_ex_v3_create_dbf.cpp +++ b/src/examples/xb_ex_v3_create_dbf.cpp @@ -2,7 +2,7 @@ XBase64 Software Library -Copyright (c) 1997,2003,2014,2022 Gary A Kunkel +Copyright (c) 1997,2003,2014,2022,2023 Gary A Kunkel The xb64 software library is covered under the terms of the GPL Version 3, 2007 license. @@ -47,19 +47,19 @@ int main() // Create Dbase3 NDX style indices if support compiled in -#ifdef XB_NDX_SUPPORT + #ifdef XB_NDX_SUPPORT xbIxNdx MyIndex1( MyDbfFile ); /* class for index 1 */ xbIxNdx MyIndex2( MyDbfFile ); /* class for index 2 */ xbIxNdx MyIndex3( MyDbfFile ); /* class for index 3 */ -#endif + #endif -// fixme -// Create Clipper NTX style indices if support compiled in - bring this back to life in a future release -#ifdef XB_INDEX_NTX + // fixme + // Create Clipper NTX style indices if support compiled in - bring this back to life in a future release + #ifdef XB_INDEX_NTX xbNtx MyIndex4( &MyDbfFile ); /* class for index 4 */ xbNtx MyIndex5( &MyDbfFile ); /* class for index 5 */ -#endif + #endif xbInt16 rc; @@ -68,7 +68,7 @@ int main() else { -#ifdef XB_NDX_SUPPORT + #ifdef XB_NDX_SUPPORT xbIx *pIx; void *pTag; @@ -83,6 +83,7 @@ int main() if(( rc = MyDbfFile->CreateTag ( "NDX", "MYINDEX1.NDX", "LASTNAME", "", 0, 1, XB_OVERLAY, &pIx, &pTag )) != XB_NO_ERROR ) x.DisplayError( rc ); + /* define a multi-field index "LASTNAME FIRSTNAME" */ if(( rc = MyDbfFile->CreateTag( "NDX", "MYINDEX2.NDX", "LASTNAME+FIRSTNAME", "", 0, 1, XB_OVERLAY, &pIx, &pTag )) != XB_NO_ERROR ) x.DisplayError( rc ); @@ -91,12 +92,19 @@ int main() if(( rc = MyDbfFile->CreateTag( "NDX", "MYINDEX3.NDX", "ZIPCODE", "", 0, 0, XB_OVERLAY, &pIx, &pTag )) != XB_NO_ERROR ) x.DisplayError( rc ); -#endif + std::cout << "Tag Count in MYINDEX3.NDX = " << pIx->GetTagCount() << "\n"; + xbString sTagName; + sTagName = pIx->GetTagName( &pTag ); + std::cout << "Tag Name in MYINDEX3.NDX = " << sTagName.Str() << "\n"; + + + #endif } MyDbfFile->Close(); /* Close database and associated indexes */ + delete MyDbfFile; -#endif // XB_DBF3_SUPPORT + #endif // XB_DBF3_SUPPORT return 0; } |