diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-03-11 18:15:40 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2023-03-11 18:15:40 +0100 |
commit | 82f6dc9f22dded1754b36b00e34e0d6806c2a55e (patch) | |
tree | 5cbcd7f9ffa01d6024fb5d2f2b5d435b5b4c7577 /src/examples | |
parent | 76f06edcf417fea572c0c0d2240ada4f377267ea (diff) | |
parent | dd70ff8bf32c2d7ed365004b1770058265db1978 (diff) |
Update upstream source from tag 'upstream/4.1.0'
Update to upstream version '4.1.0'
with Debian dir 668270cd298c590544bcaef85759fa4c7f5afc6e
Diffstat (limited to 'src/examples')
-rwxr-xr-x | src/examples/xb_ex_expression.cpp | 4 | ||||
-rwxr-xr-x | src/examples/xb_ex_ssv.cpp | 134 | ||||
-rwxr-xr-x | src/examples/xb_ex_v4_upd_dbf.cpp | 6 |
3 files changed, 140 insertions, 4 deletions
diff --git a/src/examples/xb_ex_expression.cpp b/src/examples/xb_ex_expression.cpp index dc6d7e6..840e9c6 100755 --- a/src/examples/xb_ex_expression.cpp +++ b/src/examples/xb_ex_expression.cpp @@ -65,7 +65,9 @@ void PrintResult( xbString *sExpression, xbExp *exp ){ } //********************************************************************************************************************************* -int main( int ac, char ** av ){ +//int main( int ac, char ** av ){ + +int main(){ xbInt16 iRc = 0; xbInt16 iErrorStop = 0; diff --git a/src/examples/xb_ex_ssv.cpp b/src/examples/xb_ex_ssv.cpp new file mode 100755 index 0000000..a78345f --- /dev/null +++ b/src/examples/xb_ex_ssv.cpp @@ -0,0 +1,134 @@ +/* xb_ex_ssv.cpp + +XBase64 Software Library + +Copyright (c) 1997,2003,2014,2021,2022,2023 Gary A Kunkel + +The xb64 software library is covered under the terms of the GPL Version 3, 2007 license. + +Email Contact: + + XDB-devel@lists.sourceforge.net + XDB-users@lists.sourceforge.net + +This program demonstrates using functionality of the xbSsv class (Shared system values) + +*/ + +#include "xbase.h" + +using namespace xb; + +int main( int ac, char ** av ){ + + xbXBase x; // set up xbase for business + xbString sMsg; // a message string + + sMsg.Sprintf( "Program [%s] initializing...", av[0] ); + std::cout << sMsg.Str() << std::endl; + + + // example code to set up log file usage + #ifdef XB_LOGGING_SUPPORT + char cSeperator; // is this a unix (/) or windows (\) file system + xbString sLog; // general string for log file activities + sLog = x.GetLogFqFileName().Str(); // get the system default log file name + std::cout << "System default logfile is [" << sLog.Str() << "]" << std::endl; + + cSeperator = sLog.GetPathSeparator(); // get the seperator from + std::cout << "Path seperator = [" << cSeperator << "]" << std::endl; + + sLog.Sprintf( "..%c", cSeperator ); + x.SetLogDirectory( sLog ); + std::cout << "sLog = [" << sLog.Str() << "]\n"; + + sLog = x.GetLogFqFileName().Str(); // get the system default log file name + std::cout << "New logfile is [" << sLog.Str() << "]" << std::endl; + + // turn on logging after file name set + x.EnableMsgLogging(); + #endif // XB_LOGGING_SUPPORT + + // const char *GetErrorMessage( xbInt16 ErrorCode ) const; + // void DisplayError( xbInt16 ErrorCode ) const; + std::cout << "DisplayError( -100 ) - "; + x.DisplayError( -100 ); + // << "]" << std::endl; + + // void SetDefaultDateFormat( const xbString &sDefaultDateFormat ); + // xbString& GetDefaultDateFormat() const; + std::cout << "GetDefaultDateFormat() - " << x.GetDefaultDateFormat().Str() << std::endl; + + + // void SetDataDirectory ( const xbString &sDataDirectory ); + // xbString& GetDataDirectory() const; + std::cout << "GetDataDirectory() - " << x.GetDataDirectory().Str() << std::endl; + + // xbInt16 GetEndianType() const; + if( x.GetEndianType() == 'L' ) + std::cout << "Little Endian Architecture." << std::endl; + else + std::cout << "Bid Endian Architecture." << std::endl; + + //xbBool GetDefaultAutoCommit() const; + //void SetDefaultAutoCommit( xbBool bDefaultAutoCommit ); + if( x.GetDefaultAutoCommit()) + std::cout << "AutoCommit is on." << std::endl; + else + std::cout << "AutoCommit is off." << std::endl; + + //xbBool GetMultiUser () const; + //void SetMultiUser ( xbBool bMultiUser ); + if( x.GetMultiUser()) + std::cout << "Multi user (locking) is enabled." << std::endl; + else + std::cout << "Multi user (locking) not enabled." << std::endl; + + #if defined (XB_NDX_SUPPORT) || defined (XB_MDX_SUPPORT) + // xbInt16 GetUniqueKeyOpt () const; + // xbInt16 SetUniqueKeyOpt ( xbInt16 iUniqueKeyOpt ); + // XB_HALT_ON_DUPKEY + // XB_EMULATE_DBASE + if( x.GetUniqueKeyOpt() == XB_HALT_ON_DUPKEY ) + std::cout << "UniqueKey option - XB_HALT_ON_DUPKEY" << std::endl; + else if( x.GetUniqueKeyOpt() == XB_EMULATE_DBASE ) + std::cout << "UniqueKey option - XB_EMULATE_DBASE" << std::endl; + #endif // (XB_NDX_SUPPORT) || defined (XB_MDX_SUPPORT) + + #ifdef XB_LOCKING_SUPPORT + //xbInt16 GetDefaultLockRetries () const; + //void SetDefaultLockRetries ( xbInt16 iRetryCount ); + //xbInt32 GetDefaultLockWait () const; + //void SetDefaultLockWait ( xbInt32 lRetryWait ); + //xbInt16 GetDefaultLockFlavor () const; + //void SetDefaultLockFlavor ( xbInt16 iLockFlavor ); + //xbBool GetDefaultAutoLock () const; + //void SetDefaultAutoLock ( xbBool bAutoLock ); + //void EnableDefaultAutoLock (); + //void DisableDefaultAutoLock (); + + std::cout << "GetDefaultLockRetries() - " << x.GetDefaultLockRetries() << std::endl; + std::cout << "GetDefaultLockWait() - " << x.GetDefaultLockWait() << std::endl; + std::cout << "GetDefaultAutoLock() - " << x.GetDefaultAutoLock() << std::endl; + #endif // XB_LOCKING_SUPPORT + + #ifdef XB_MDX_SUPPORT + // xbInt16 GetCreateMdxBlockSize() const; + // xbInt16 SetCreateMdxBlockSize( xbInt16 ulBlockSize ); + std::cout << "GetCreateMdxBlockSize() - " << x.GetCreateMdxBlockSize() << std::endl; + #endif // XB_MDX_SUPPORT + + #ifdef XB_BLOCKREAD_SUPPORT + // xbUInt32 GetDefaultBlockReadSize() const; + // void SetDefaultBlockReadSize( xbUInt32 ulDfltBlockReadSize ); + std::cout << "GetDefaultBlockReadSize() - " << x.GetDefaultBlockReadSize() << std::endl; + #endif // XB_BLOCKREAD_SUPPORT + + //xbBool BitSet ( unsigned char c, xbInt16 iBitNo ) const; + //void BitDump ( unsigned char c ) const; + //void BitDump ( char c ) const; + std::cout << "BitDump( 'A' ) - "; + x.BitDump( 'A' ); + + return 0; +} diff --git a/src/examples/xb_ex_v4_upd_dbf.cpp b/src/examples/xb_ex_v4_upd_dbf.cpp index 96b6bdf..75d0641 100755 --- a/src/examples/xb_ex_v4_upd_dbf.cpp +++ b/src/examples/xb_ex_v4_upd_dbf.cpp @@ -258,15 +258,15 @@ int main() throw iRc; } - // example code to loop through the table - for( xbUInt32 ulTuple = 1; ulTuple <= MyTable->GetRecordCount(); ulTuple++ ){ - if(( iRc = MyTable->GetRecord( ulTuple ) != XB_NO_ERROR )){ + for( xbUInt32 ul = 1; ul <= MyTable->GetRecordCount(); ul++ ){ + if(( iRc = MyTable->GetRecord( ul )) != XB_NO_ERROR ){ iErrorStop = 430; throw iRc; } // do something with the record here std::cout << "Tuple = " << MyTable->GetCurRecNo() << std::endl; + } /* Close database and associated indexes */ |