Date and Calendar Analytics
Configurations

API for Initializing, configuring, and shutdown the Date and Calendar analytics API. More...

Functions

int __stdcall SFDB_Init (LPCWSTR szBaseFileName, LPCWSTR szResDir, DWORD dwLocale, unsigned int *pClientToken)
 Initialize/Configure the date/calendar analytics module (SFDBM)
 
int __stdcall SFDB_Shutdown (unsigned int uClientToken)
 Shutdown the session (e.g. closes files, terminate database connection, etc.)
 

Detailed Description

A set of functions to configure the date and calendar module, including the calendar database file's location, locality, and filename.

Function Documentation

◆ SFDB_Init()

int __stdcall SFDB_Init ( LPCWSTR szBaseFileName,
LPCWSTR szResDir,
DWORD dwLocale,
unsigned int * pClientToken )

initialize and configure the SFDBM module

Parameters
[in]szBaseFileName(Required) the base filename of the database file (e.g., spiderxl.db)
[in]szResDir(Optional) the location of the calendar resources files
[in]dwLocale(Required) the MS Locality ID
[out]pClientToken(Required) a pointer to a varaible to hold the calculated integer token used during the calendar facility shutdown
Returns
status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
Return values
NDK_SUCCESSsuccess
NDK_SKIP_INITsuccess with a warning (see remarks)
NDK_DATAPATH_INVALIDfailed (see remarks)
NDK_INVALID_ARGfailed (see remarks)
NDK_UNSUPPORTED_LCIDfailed (see remarks)
NDK_INIT_FAILED(see remarks)
NDK_FAILEDfailed
Remarks
  1. The NumXL SDK comes with a standard db file for calendars definition and holidays:
    Locality File
    English 1033/spiderxl.db
    Spanish 1034/spiderxl.db
  2. The stock calendar database file (i.e., spiderxl.db) contains definition of all calendars and holidays available to NumXL add-ins.
  3. The NumXL SDK package copies the calendar database file into locale-specific subfolders (e.g., 1033, 1034) of the output (binary/executable) folder. If you don't plan a different folder structure, then pass NULL for the szResDir argument.
  4. If you wish to use the stock calendar database file, then pass the value spiderxl.db for the szBaseFileName argument.
  5. If the path referenced by szResDir does not exists, the function will fail and return NDK_DATAPATH_INVALID error code.
  6. If the calendar module has already been initialized (i.e., the SFDB_Init was called earlier), the function will ignore the call and returns a warning code NDK_SKIP_INIT
  7. If the value of pClientToken is NULL, the function will fails and return NDK_INVALID_ARG error code.
  8. If the value of dwLocale is greater than zero, and there is no corresponding subfolder in the szResDir (or the DLL directory, if szResDir is NULL), the function will fails and return NDK_UNSUPPORTED_LCID error code.
  9. If the calendar database file (i.e. szBaseFileName) does not exist, the function will fail and return NDK_UNSUPPORTED_LCID error code.
  10. If the calendar database file exists, but the module failed to open it, the function will fail and return NDK_INIT_FAILED error code.
Demo
LCID dwLocale = 1033;
std::wstring szFileName(TEXT("spiderxl.db"));
nRetCode = SFDB_Init(szFileName.c_str(), NULL /* Use DLL folder */, dwLocale, &uDBMToken);
if(nRetCode == NDK_SUCCESS){
std::wcout << L" SUCCESS - Date and Calendar module is initialized" << std::endl;
Requirements
Requirement Value
Target Platform Windows
Header SFDBM.h (include Windows.h)
Library SFDBM.lib
DLL SFDBM.dll
SFLUC.dll
SFLOG.dll
Since
v1.56
See also
Examples
dbm_init.cpp.

◆ SFDB_Shutdown()

int __stdcall SFDB_Shutdown ( unsigned int uClientToken)

shutdown and release resources used by SFDBM Library

Parameters
[in]uClientToken(Required) is an integer token acquired during the calendar facility initialization.
Returns
status code of the function call: zero = success, positive = success with a warning, and negative = error occurred.
Return values
NDK_SUCCESSsuccess
NDK_INVALID_ARGfailed (see remarks)
NDK_UNINITIALIZEDfailed (see remarks)
NDK_INVALID_TOKENfailed (see remarks)
NDK_FAILEDfailed
Remarks
  1. If the calendar module has not been initialized, the function will fail and return NDK_UNINITIALIZED as the return code.
  2. If the value of uClientToken argument is invalid, the function will fail and return NDK_INVALID_TOKEN as a return code.
Demo
if(uDBMToken != unsigned(-1)){
SFDB_Shutdown(uDBMToken);
uDBMToken = unsigned(-1);
}
Requirements
Requirement Value
Target Platform Windows
Header SFDBM.h (include Windows.h)
Library SFDBM.lib
DLL SFDBM.dll
SFLUC.dll
SFLOG.dll
Since
v1.68
See also
Examples
dbm_init.cpp.