From dd70ff8bf32c2d7ed365004b1770058265db1978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 11 Mar 2023 18:15:37 +0100 Subject: New upstream version 4.1.0 --- docs/html/xbc18.html | 252 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100755 docs/html/xbc18.html (limited to 'docs/html/xbc18.html') diff --git a/docs/html/xbc18.html b/docs/html/xbc18.html new file mode 100755 index 0000000..36f3b50 --- /dev/null +++ b/docs/html/xbc18.html @@ -0,0 +1,252 @@ + + +Xbase DBMS Chapter 18 + +

Class xbXBase

+

Chapter Updated 2/7/23


+ +

Class xbXBase - Core Level Class

+ + +The xbXBase class is the core class that needs to be in every application program. +Established an instance of class xbXBase before any other Xbase calls are made. + +xbXBase x + +

+xbXBase is derived from base classes xbTblMgr and xbSsv. +



+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MethodDescriptionCategory
xbInt16 CloseAllTables()Close all open tables.Table
xbInt16 OpenHighestVersion( const xbString &sTableName, const xbString &sAlias, xbDbf &dbf, int dummy )Open highest version available for sTableName.Table
xbInt16 OpenHighestVersion( const xbString &sTableName, const xbString &sAlias, xbDbf **dbf )Open highest version available for sTableName.Table
xbDbf * Open( const xbString &sTableName, xbInt16 &iRc )Open the highest available version of the dbf file. Defaults to XB_READ_WRITE and XB_MULTI_USER mode.Table
xbDbf * Open( const xbString &sTableName, const xbString &sAlias, xbInt16 iOpenMode, xbInt16 iShareMode, xbInt16 iVersion, xbInt16 &iRc )Open table.Table

void DisableMsgLogging()Disable logging routines.Logging
void EnableMsgLogging ()Enable logging routines.Logging
xbInt16 FlushLog()Flush any queued logfile updates to disk.Logging
const xbString &GetLogDirectory () constGet the current logfile directory.Logging
const xbString &GetLogFileName () constGet the current logfile name.Logging
const xbString &GetLogFqFileName() constGet fully qualified logfile name.Logging
xbBool GetLogStatus () constGet the logging status.Logging
void SetLogDirectory( const xbString &sLogFileDirectory )Set the log directory. Must be done while logging is off.Logging
void SetLogFileName( const xbString &sLogFileName )Set the log file name. Must be done while logging is off.Logging
void SetLogSize( size_t lSize )Set the logfile size. After the size is reached, the log file roll.Logging
xbInt16 WriteLogBytes ( xbUInt32 lCnt, const char *p )Write lCnt bytes pointed to by pointer p to the logfile.Logging
xbInt16 WriteLogMessage( const xbString &sLogMessage, xbInt16 iOutputOpt = 0 )Write a string to the logfile.Logging

xbInt16 xbXBase::GetCmdLineOpt( xbInt32 lArgc, char **sArgv, xbString &sOptRqst, xbString &sParmOut )
+xbXBase::GetCmdLineOpt( xbInt32 lArgc, char **sArgv, const char *sOptRqst, xbString &sParmOut )
Parse command line values seeking given parameter info.Misc
void xbSleep( xbInt32 lMillisecs )Sleep command, used mainly in lock commands for waiting between retries.Misc

xbInt16 ABS( xbDouble dIn, xbDouble &dOut )Dbase ABS function.Expression
xbInt16 ALLTRIM( const xbString &sIn, xbString &sOut )Dbase ALLTRIM function.Expression
xbInt16 ASC( const xbString &s, xbDouble &dAscOut )Dbase ASC function.Expression
xbInt16 AT( const xbString &sSrchFor, const xbString &sBase, xbDouble &dPos )Dbase AT function.Expression
xbInt16 CDOW( xbDate &dInDate, xbString &sOutDow )Dbase CDOW function.Expression
xbInt16 CHR( xbDouble dAsciCd, xbString &sOut )Dbase CHR function.Expression
xbInt16 CMONTH( xbDate &dInDate, xbString &sOutMonth )Dbase CMONTH function.Expression
xbInt16 CTOD( const xbString &sInDate, xbDate &dOutDate )Dbase CTOD function.Expression
xbInt16 DATE( xbDate &dOutDate )Dbase DATE function.Expression
xbInt16 DAY( const xbDate &dInDate, xbDouble &dOutDay )Dbase DAY function.Expression
xbInt16 DEL( xbDbf * d, xbString &sOut, xbInt16 iRecBufSw = 0 )Dbase DEL function.Expression
xbInt16 DELETED( xbDbf * d, xbBool &bOut, xbInt16 iRecBufSw = 0 )Dbase DELETED function.Expression
xbInt16 DESCEND( const xbString &sIn,xbString &sOut )
xbInt16 DESCEND( const xbDate &dInDate, xbDate &dOutDate )
xbInt16 DESCEND( const xbDouble dIn, xbDouble &dsOut )
Dbase DESCEND function.Expression
xbInt16 DOW( const xbDate &sInDate, xbDouble &dDowOut )Dbase DOW function.Expression
xbInt16 DTOC( xbDate &dInDate, xbString &sOutFmtDate )Dbase DTOC function.Expression
xbInt16 DTOS( xbDate &dInDate, xbString &sOutFmtDate )Dbase DTOS function.Expression
xbInt16 EXP( xbDouble dIn, xbDouble &dOut )Dbase EXP function.Expression
xbInt16 IIF( xbBool bResult, const xbString &sTrueResult, const xbString &sFalseResult, xbString &sResult )Dbase IIF function.Expression
xbInt16 INT( xbDouble dIn, xbDouble &dOut )Dbase INT function.Expression
xbInt16 ISALPHA( const xbString &s, xbBool &bResult )Dbase ISALPHA function.Expression
xbInt16 ISLOWER( const xbString &s, xbBool &bResult )Dbase ISLOWER function.Expression
xbInt16 ISUPPER( const xbString &s, xbBool &bResult )Dbase ISUPPER function.Expression
xbInt16 LEFT( const xbString &sIn, xbUInt32 lCharCnt, xbString &sOut )Dbase LEF function.Expression
xbInt16 LEN( const xbString &sIn, xbDouble &dLen )Dbase LEN function.Expression
xbInt16 LOG( xbDouble dIn, xbDouble &dOut )Dbase LOG function.Expression
xbInt16 LOWER( const xbString &sIn, xbString &sOut )Dbase LOWER function.Expression
xbInt16 LTRIM( const xbString &sIn, xbString & sOut )Dbase LTRIM function.Expression
xbInt16 MAX( xbDouble dIn1, xbDouble dIn2, xbDouble &dOut )Dbase MAX function.Expression
xbInt16 MIN( xbDouble dIn1, xbDouble dIn2, xbDouble &dOut )Dbase MIN function.Expression
xbInt16 MONTH( xbDate &dInDate, xbDouble &dMonthOut )Dbase MONTH function.Expression
xbInt16 RECCOUNT( xbDbf * d, xbDouble &dRecOut )Dbase RECCOUNT function.Expression
xbInt16 RECNO( xbDbf * d, xbDouble &dRecOut )Dbase RECNO function.Expression
xbInt16 REPLICATE( const xbString &sIn, xbUInt32 ulRepCnt, xbString &sOut )Dbase REPLICATE function.Expression
xbInt16 RIGHT( const xbString &sIn, xbUInt32 iCharCnt, xbString &sOut )Dbase RIGHT function.Expression
xbInt16 RTRIM( const xbString &sIn, xbString &sOut )Dbase RTRIM function.Expression
xbInt16 SPACE( xbInt32 lCnt, xbString &sOut )Dbase SPACE function.Expression
xbInt16 SQRT( xbDouble dBase, xbDouble &dSqrRt )Dbase SQRT function.Expression
xbInt16 STOD( const xbString &sIn, xbDate &sDateOut )Dbase STOD function.Expression
xbInt16 STR( xbDouble dIn, xbString &sOut )Dbase function.Expression
xbInt16 STR( xbDouble dIn, xbUInt32 ulLen, xbString &sOut )
+ xbInt16 STR( xbDouble dIn, xbUInt32 ulLen, xbUInt32 ulDec, xbString &sOut )
+ xbInt16 STR( xbDouble dIn, xbUInt32 ulLen, xbUInt32 ulDec, xbString &sPadChar, xbString &sOut )
Dbase STR function.Expression
xbInt16 STRZERO( xbDouble dIn, xbUInt32 ulLen, xbUInt32 ulDec, xbString &sOut )Dbase STRZERO function.Expression
xbInt16 SUBSTR( const xbString &sIn, xbUInt32 ulStartPos, xbUInt32 ulLen, xbString &sOut )Dbase SUBSTR function.Expression
xbInt16 TRIM( const xbString &sIn, xbString &sOut )Dbase TRIM function.Expression
xbInt16 UPPER( const xbString &sIn, xbString &sOut )Dbase UPPER function.Expression
xbInt16 VAL( const xbString &sIn, xbDouble &dOut )Dbase VAL function.Expression
xbInt16 YEAR( xbDate &dInDate, xbDouble &dOutYear )Dbase YEAR function.Expression
+ +

+
+ +

Example program using xbXbase methods

+
+ +/* 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() << std::endl; + + // void SetDataDirectory ( const xbString &sDataDirectory ); + // xbString& GetDataDirectory() const; + std::cout << "GetDataDirectory() - " << x.GetDataDirectory() << 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; +} + + + + +

+
+



+ + -- cgit v1.2.3