ctSQLImportTable Imports a table to the c-treeSQL data dictionaries. Declaration The function prototype is as follows: NINT ctSQLImportTable(pCTSQLIMPOPTS pctsqlimpopts); Description The caller passes the address of a CTSQLIMPOPTS structure, which specifies the table import options: typedef struct tagCTSQLIMPOPTS {
pTEXT tblnam; /* name of table to import */ pTEXT symnam; /* symbolic table name */ pTEXT dbsnam; /* name of c-treeSQL database (default: ctreeSQL) */ pTEXT srvnam; /* c-treeSQL Server name (default: FAIRCOMS) */ pTEXT usrnam; /* userid for connecting to c-treeSQL Server */ pTEXT usrpwd; /* password for authentication */ pTEXT tblown; /* assign table owner */ SQLCBF clbkfn; /* callback function */ NINT chkfld; /* skip fields that don't comply with */ /* conventional SQL identifier rules */ NINT skpidx; /* skip indices */ NINT rmlink; /* unlink table from database */ } CTSQLIMPOPTS, *pCTSQLIMPOPTS; The clbkfn field can be used to specify a callback function called by ctSQLImportTable() in certain situations. If no callback function address is specified, c-tree uses the default callback function SQLLinkCallback() found in ctsqlimp.c. This default callback function prompts the user for input in some situations. To avoid these prompts, developers can implement their own version of this function and can pass the address of this function to ctSQLImportTable() by setting the clbkfn field to the address of the custom callback function. ctSQLImportTable() is implemented using c-treeDB API functions. An application using only ISAM or low-level functions can call ctSQLImportTable() provided the application #includes the c-treeDB header file ctdbsdk.h and links with a c-tree client library that is built with c-treeDB C API support. Returns
See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values. Example
CTSQLIMPOPTS impopts; impopts.tblnam = ".\\qasqlimp.dat"; impopts.symnam = "inventory"; impopts.dbsnam = "ctreeSQL"; impopts.srvnam = "FAIRCOMS@localhost"; impopts.usrnam = "ADMIN"; impopts.usrpwd = "ADMIN"; impopts.clbkfn = mySQLLinkCallback; ctrt_printf("Import ok\n");
else ctrt_printf("Import failed: %d\n", rc);
|
||||||||||||