Before you can access data and index files created by an ISAM application with FairCom DB SQL, you need to import the data into FairCom DB SQL. For this purpose, FairCom has created the FairCom DB SQL Import Utility, ctsqlimp.
ctsqlimp - FairCom DB SQL Import Utility
Details
As we import a table into FairCom DB SQL, the utility reads the field definitions from the table’s DODA and populates FairCom DB SQL system catalog tables. We cannot allow the import utility to import the MYTIME fields as CT_INT4 field types. We have to make sure the import utility will import the MYTIME fields as CT_TIMES fields (equivalent to FairCom DB SQL TIMESTAMP field type).
Import Utility Callback Architecture
Each time a table is imported into FairCom DB SQL, the import utility will try to load an import utility dynamic callback library.
Note: For Windows systems, the dynamic callback library is called ctsqlimp.dll. For Unix based systems, the dynamic callback library is named libctsqlimp with a filename extention appropriate to that operating system's default shared library conventions (.so, .sl., .dynlib, etc.).
The diagram below depicts the relationship of the import utility with the callback library and its configuration file:

If the callback library is not located, the import utility proceeds normally with the table import process. No errors are reported since the presence of the dynamic library is not required for normal import utility operations.
If the callback library is located and loaded, the following steps are taken:
- The ctsqlcbk.ini configuration file is loaded and parsed.
- The appropriate c-treeDB API callbacks are established.
- The import utility continues if no errors are reported.
- The configuration file is the same used by FairCom DB SQL and it is described in detail in the FairCom DB SQL callback configuration file section.
Import Utility Callback Configuration File
The configuration file used by the import utility dynamic library is the same configuration file used by FairCom DB SQL.
The import utility expects the configuration file to be located in the same directory as the import utility executable file, and that the current directory is set to the directory where the import utility executable file is located.
Building the callback libraries
The only source modules used to build the callback libraries are ctsqlcbk.c and ctcbklib.c. Under Windows systems we also need ctsqlcbk.def to build the FairCom DB SQL callback library, and ctsqlimp.def to build the import utility callback library.
The callback libraries have no dependencies on FairCom DB or c-treeDB API libraries. Only the header files are referenced.
Below are example makefiles you could use to build the ctsqlcbk.dll for Windows. Unix shared library files are quite similar, and you should consult your local compiler documentation for details.
Note: The compiler and FairCom DB paths will need to be adjusted for your particular development environment. You may wish to investigate your own compiler options and flags based upon your unique needs.
Example Server Callback Makefile
#############################################################
# Your c-treeSQL callback dll makefile
#
# Operating Sys: MS-Windows NT/XP (Intel)
# Compiler: Visual C/C++ (v6.x , v12.xx.xxxx) -VC98: 32bit
# Memory Model: Flat Memory Model
# Protocol: TCP/IP Sockets
#############################################################
# PATH Definition Section
mtBAS =mtmake # m-tree's Base
coBAS =C:\PROGRA~1\MICROS~3\VC98 # Compiler's Base
coBIN =C:\PROGRA~1\MICROS~3\VC98\bin # Compiler's BIN
coBINB=C:\PROGRA~1\MICROS~3\Common\msdev98\bin # Compiler's BINB
coLIB =C:\PROGRA~1\MICROS~3\VC98\lib # Compiler's LIB
coINC =C:\PROGRA~1\MICROS~3\VC98\include # Compiler's INCLUDE
fcBAS =D:\fc8\ctreeSDK\ctreeAPI # FairCom Base
fcSRC =D:\fc8\ctreeSDK\ctreeAPI\ctree\source # FairCom Source
fcINC =D:\fc8\ctreeSDK\ctreeAPI\ctree\include # FairCom Include
fcTOM =D:\fc8\ctreeSDK\ctreeAPI\custom.sql # Custom client Settings
# Compiler/Linker Macro Definition Section
# Object File Switch
CCOF =/Fo
.SUFFIXES:
.SUFFIXES: .c .obj
CP = copy
CPP= $(coBIN)\cl
CC = $(coBIN)\cl
LIBRARIAN = $(coBIN)\lib
RC = $(coBINB)\rc
IMPLIB = $(coBIN)\implib
LINKPP = $(coBIN)\link -subsystem:windows -debug:full -debugtype:cv -pdb:none
LINK = $(coBIN)\link -subsystem:windows -debug:full -debugtype:cv -pdb:none
LINK3 = $(coBIN)\link -subsystem:console -debug:full -debugtype:cv -pdb:none
CFLAGS = -c -DWIN32 -D_X86_=1 -GX $(fcDDD) -Zi -Od
CFLAG2 = -c -DWIN32 -D_X86_=1 -GX $(fcDDD) -Zi -Od
CFLAG3 = -c -DWIN32 -D_X86_=1 -GX $(fcDDD) -Zi -Od
# Make the following components
ALL :: ctsqlcbk.dll
ctsqlcbk.dll: ctsqlcbk.obj ctcbklib.obj
$(LINK) /DLL /MACHINE:IX86 /DEF:ctsqlcbk.def /OUT:ctsqlcbk.dll ctsqlcbk.obj ctcbklib.obj
ctsqlcbk.obj: ctsqlcbk.c
$(CC) -I$(fcINC) -I$(fcSRC) -I$(fcTOM) $(CFLAG2) ctsqlcbk.c
ctcbklib.obj: ctcbklib.c
$(CC) -I$(fcINC) -I$(fcSRC) -I$(fcTOM) $(CFLAG2) ctcbklib.c
Example Import Utility Callback Makefile
#############################################################
# import utility callback dll
#
# Operating Sys: MS-Windows NT (Intel)
# Compiler: Visual C/C++ (v6.x , v12.xx.xxxx) -VC98: 32bit
# Memory Model: Flat Memory Model
# Protocol: TCP/IP Sockets
#############################################################
# PATH Definition Section
mtBAS =mtmake # m-tree's Base
coBAS =C:\PROGRA~1\MICROS~3\VC98 # Compiler's Base
coBIN =C:\PROGRA~1\MICROS~3\VC98\bin # Compiler's BIN
coBINB=C:\PROGRA~1\MICROS~3\Common\msdev98\bin # Compiler's BINB
coLIB =C:\PROGRA~1\MICROS~3\VC98\lib # Compiler's LIB
coINC =C:\PROGRA~1\MICROS~3\VC98\include # Compiler's INCLUDE
fcBAS =D:\fc8\ctreeSDK\ctreeAPI # FairCom Base
fcSRC =D:\fc8\ctreeSDK\ctreeAPI\ctree\source # FairCom Source
fcINC =D:\fc8\ctreeSDK\ctreeAPI\ctree\include # FairCom Include
fcTOM =D:\fc8\ctreeSDK\ctreeAPI\custom.cli # Custom client Settings
# Compiler/Linker Macro Definition Section
# Object File Switch
CCOF =/Fo
.SUFFIXES:
.SUFFIXES: .c .obj
CP = copy
CPP= $(coBIN)\cl
CC = $(coBIN)\cl
LIBRARIAN = $(coBIN)\lib
RC = $(coBINB)\rc
IMPLIB = $(coBIN)\implib
LINKPP = $(coBIN)\link -subsystem:windows -debug:full -debugtype:cv -pdb:none
LINK = $(coBIN)\link -subsystem:windows -debug:full -debugtype:cv -pdb:none
LINK3 = $(coBIN)\link -subsystem:console -debug:full -debugtype:cv -pdb:none
CFLAGS = -c -DWIN32 -D_X86_=1 -GX $(fcDDD) -Zi -Od
CFLAG2 = -c -DWIN32 -D_X86_=1 -GX $(fcDDD) -Zi -Od
CFLAG3 = -c -DWIN32 -D_X86_=1 -GX $(fcDDD) -Zi -Od
# Make the following components
ALL :: ctsqlimp.dll
ctsqlimp.dll: ctsqlcbk.obj ctcbklib.obj
$(LINK) /DLL /MACHINE:IX86 /DEF:ctsqlimp.def /OUT:ctsqlimp.dll ctsqlcbk.obj ctcbklib.obj
ctsqlcbk.obj: ctsqlcbk.c
$(CC) -I$(fcINC) -I$(fcSRC) -I$(fcTOM) $(CFLAG2) ctsqlcbk.c
ctcbklib.obj: ctcbklib.c
$(CC) -I$(fcINC) -I$(fcSRC) -I$(fcTOM) $(CFLAG2) ctcbklib.c