Added support for large field values (up to 4 GB), async and direct I/O on Linux and Solaris, and performed major code cleanup.
git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@213 0109f412-320b-0410-ab79-c3e0c5ffbbe6
This commit is contained in:
@@ -24,10 +24,101 @@
|
||||
|
||||
#include "flaimsys.h"
|
||||
|
||||
/*API~***********************************************************************
|
||||
Desc : Returns TRUE if the passed in RCODE indicates that a corruption
|
||||
has occured in a FLAIM database file.
|
||||
*END************************************************************************/
|
||||
/****************************************************************************
|
||||
Desc: FLAIM language code table
|
||||
****************************************************************************/
|
||||
static char flmLangTable[ LAST_LANG + LAST_LANG] =
|
||||
{
|
||||
'U', 'S', // English, United States
|
||||
'A', 'F', // Afrikaans
|
||||
'A', 'R', // Arabic
|
||||
'C', 'A', // Catalan
|
||||
'H', 'R', // Croatian
|
||||
'C', 'Z', // Czech
|
||||
'D', 'K', // Danish
|
||||
'N', 'L', // Dutch
|
||||
'O', 'Z', // English, Australia
|
||||
'C', 'E', // English, Canada
|
||||
'U', 'K', // English, United Kingdom
|
||||
'F', 'A', // Farsi
|
||||
'S', 'U', // Finnish
|
||||
'C', 'F', // French, Canada
|
||||
'F', 'R', // French, France
|
||||
'G', 'A', // Galician
|
||||
'D', 'E', // German, Germany
|
||||
'S', 'D', // German, Switzerland
|
||||
'G', 'R', // Greek
|
||||
'H', 'E', // Hebrew
|
||||
'M', 'A', // Hungarian
|
||||
'I', 'S', // Icelandic
|
||||
'I', 'T', // Italian
|
||||
'N', 'O', // Norwegian
|
||||
'P', 'L', // Polish
|
||||
'B', 'R', // Portuguese, Brazil
|
||||
'P', 'O', // Portuguese, Portugal
|
||||
'R', 'U', // Russian
|
||||
'S', 'L', // Slovak
|
||||
'E', 'S', // Spanish
|
||||
'S', 'V', // Swedish
|
||||
'Y', 'K', // Ukrainian
|
||||
'U', 'R', // Urdu
|
||||
'T', 'K', // Turkey
|
||||
'J', 'P', // Japanese
|
||||
'K', 'R', // Korean
|
||||
'C', 'T', // Chinese-Traditional
|
||||
'C', 'S', // Chinese-Simplified
|
||||
'L', 'A' // Future asian language
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
Desc: Determine the language number from the 2 byte language code
|
||||
****************************************************************************/
|
||||
FLMEXP FLMUINT FLMAPI FlmLanguage(
|
||||
char * pszLanguageCode)
|
||||
{
|
||||
char cFirstChar = *pszLanguageCode;
|
||||
char cSecondChar = *(pszLanguageCode + 1);
|
||||
FLMUINT uiTablePos;
|
||||
|
||||
for (uiTablePos = 0; uiTablePos < (LAST_LANG+LAST_LANG); uiTablePos += 2 )
|
||||
{
|
||||
if (flmLangTable[ uiTablePos] == cFirstChar &&
|
||||
flmLangTable[ uiTablePos + 1] == cSecondChar)
|
||||
{
|
||||
|
||||
// Return uiTablePos div 2
|
||||
|
||||
return( uiTablePos >> 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Language not found, return default US language
|
||||
|
||||
return( US_LANG);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc: Determine the language code from the language number
|
||||
****************************************************************************/
|
||||
FLMEXP void FLMAPI FlmGetLanguage(
|
||||
FLMUINT uiLangNum,
|
||||
char * pszLanguageCode)
|
||||
{
|
||||
if (uiLangNum >= LAST_LANG)
|
||||
{
|
||||
uiLangNum = US_LANG;
|
||||
}
|
||||
|
||||
uiLangNum += uiLangNum;
|
||||
*pszLanguageCode++ = flmLangTable[ uiLangNum];
|
||||
*pszLanguageCode++ = flmLangTable[ uiLangNum + 1];
|
||||
*pszLanguageCode = 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Desc: Returns TRUE if the passed in RCODE indicates that a corruption
|
||||
has occured in a FLAIM database file.
|
||||
****************************************************************************/
|
||||
FLMEXP FLMBOOL FLMAPI FlmErrorIsFileCorrupt(
|
||||
RCODE rc)
|
||||
{
|
||||
@@ -35,43 +126,35 @@ FLMEXP FLMBOOL FLMAPI FlmErrorIsFileCorrupt(
|
||||
|
||||
switch( rc)
|
||||
{
|
||||
/* This is the list of errors within FLAIM that indicate a corruption
|
||||
has been found within FLAIM database file. */
|
||||
case FERR_BTREE_ERROR :
|
||||
case FERR_DATA_ERROR :
|
||||
case FERR_DD_ERROR :
|
||||
case FERR_NOT_FLAIM :
|
||||
case FERR_PCODE_ERROR :
|
||||
case FERR_BLOCK_CHECKSUM :
|
||||
case FERR_INCOMPLETE_LOG :
|
||||
case FERR_KEY_NOT_FOUND :
|
||||
case FERR_NO_REC_FOR_KEY:
|
||||
b = TRUE;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
case FERR_BTREE_ERROR :
|
||||
case FERR_DATA_ERROR :
|
||||
case FERR_DD_ERROR :
|
||||
case FERR_NOT_FLAIM :
|
||||
case FERR_PCODE_ERROR :
|
||||
case FERR_BLOCK_CHECKSUM :
|
||||
case FERR_INCOMPLETE_LOG :
|
||||
case FERR_KEY_NOT_FOUND :
|
||||
case FERR_NO_REC_FOR_KEY:
|
||||
b = TRUE;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
return( b);
|
||||
}
|
||||
|
||||
|
||||
/*API~***********************************************************************
|
||||
Desc : Returns specific information about the most recent error that
|
||||
occured within FLAIM.
|
||||
Notes: FLAIM maintains information about the operation which generated
|
||||
the error. This information can include a field number
|
||||
or other information specific to the operation and can
|
||||
be useful in identifying the cause of the error.
|
||||
*END************************************************************************/
|
||||
/****************************************************************************
|
||||
Desc: Returns specific information about the most recent error that
|
||||
occured within FLAIM.
|
||||
****************************************************************************/
|
||||
FLMEXP RCODE FLMAPI FlmGetDiagInfo(
|
||||
HFDB hDb,
|
||||
eDiagInfoType eDiagCode,
|
||||
void * pvDiagInfo
|
||||
)
|
||||
void * pvDiagInfo)
|
||||
{
|
||||
RCODE rc = FERR_OK;
|
||||
FDB * pDb;
|
||||
RCODE rc = FERR_OK;
|
||||
FDB * pDb;
|
||||
|
||||
if ((pDb = (FDB *)hDb) == NULL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user