Question: | How do I change settings in the IDAPI.cfg file programmatically in C++? |
Solution: | You need to use the DbiOpenCfgInfoList BDE API call. The following code example is a function that will take in a path to the part you want to change, and a value that you want to change it to. |
Code: | void
__fastcall SetConfigParameter(String Param, String
Value){ hDBICur hCur; DBIResult rslt; CFGDesc Config; String Path, Option; bool Found; char Temp[256]; hCur = NULL; Found = false; if (Param.Pos (";") == 0){ ShowMessage (String ("Invalid parameter passed to function. There must ") + String ("be a semi-colon delimited sting passed")); return; } Path = Param.SubString (0, Param.Pos(";") — 1); Option = Param.SubString(Param.Pos(";") + 1, Param.Length () — Param.Pos (";")); Check(DbiOpenCfgInfoList(NULL, dbiREADWRITE, cfgPersistent, StrPCopy(Temp, Path), hCur)); do{ rslt = DbiGetNextRecord(hCur, dbiNOLOCK, &Config, NULL); if (rslt == DBIERR_NONE){ if (StrPas(Config.szNodeName) == Option){ StrPCopy(Config.szValue, Value); Check(DbiModifyRecord(hCur, &Config, false)); Found = true; break; } } else{ if (rslt != DBIERR_EOF){ Check(rslt); } } }while (rslt != DBIERR_NONE); if (Found == false){ ShowMessage (Param + " entry was not found in configuration file"); } if (hCur != NULL){ Check(DbiCloseCursor(hCur)); } } |
Commonly Used Paths: | { Paradox
Driver Settings ... } PARADOXNETDIR = "\\DRIVERS\\PARADOX\\INIT\\NET DIR"; PARADOXVERSION = "\\DRIVERS\\PARADOX\\INIT\\VERSION"; PARADOXTYPE = "\\DRIVERS\\PARADOX\\INIT\\TYPE"; PARADOXLANGDRIVER = "\\DRIVERS\\PARADOX\\INIT\\LANGDRIVER"; PARADOXLEVEL = "\\DRIVERS\\PARADOX\\TABLE CREATE\\LEVEL"; PARADOXBLOCKSIZE = "\\DRIVERS\\PARADOX\\TABLE CREATE\\BLOCK SIZE"; PARADOXFILLFACTOR = "\\DRIVERS\\PARADOX\\TABLE CREATE\\FILL FACTOR"; PARADOXSTRICTINTEGRITY = "\\DRIVERS\\PARADOX\\TABLE CREATE\\STRICTINTEGRITY"; { dBASE Driver Settings... } DBASEVERSION = "\\DRIVERS\\DBASE\\INIT\\VERSION"; DBASETYPE = "\\DRIVERS\\DBASE\\INIT\\TYPE"; DBASELANGDRIVER = "\\DRIVERS\\DBASE\\INIT\\LANGDRIVER"; DBASELEVEL = "\\DRIVERS\\DBASE\\TABLE CREATE\\LEVEL"; DBASEMDXBLOCKSIZE = "\\DRIVERS\\DBASE\\TABLE CREATE\\MDX BLOCK SIZE"; DBASEMEMOFILEBLOCKSIZE = "\\DRIVERS\\DBASE\\TABLE CREATE\\MEMO FILE BLOC SIZE"; { InterBase Driver Settings... } INTERBASESERVERNAME = "\\DRIVERS\\INTRBASE\\DB OPEN\\SERVER NAME"; INTERBASEUSERNAME = "\\DRIVERS\\INTRBASE\\DB OPEN\\USER NAME"; INTERBASEOPENMODE = "\\DRIVERS\\INTRBASE\\DB OPEN\\OPEN MODE"; INTERBASESCHEMACACHESIZE = "\\DRIVERS\\INTRBASE\\DB OPEN\\SCHEMA CACHE SIZE"; INTERBASELANGDRIVER = "\\DRIVERS\\INTRBASE\\DB OPEN\\LANGDRIVER"; INTERBASESQLQRYMODE = "\\DRIVERS\\INTRBASE\\DB OPEN\\SQLQRYMODE"; INTERBASESQLPASSTHRUMODE = "\\DRIVERS\\INTRBASE\\DB OPEN\\SQLPASSTHRU MODE"; INTERBASESCHEMACACHETIME = "\\DRIVERS\\INTRBASE\\DB OPEN\\SCHEMS CACHE TIME"; INTERBASEMAXROWS = "\\DRIVERS\\INTRBASE\\DB OPEN\\MAX ROWS"; INTERBASEBATCHCOUNT = "\\DRIVERS\\INTRBASE\\DB OPEN\\BATCH COUNT"; INTERBASEENABLESCHEMACACHE = "\\DRIVERS\\INTRBASE\\DB OPEN\\ENABLE SCHEMA CACHE"; INTERBASEENABLEBCD = "\\DRIVERS\\INTRBASE\\DB OPEN\\ENABLE BCD"; INTERBASEBLOBSTOCACHE = "\\DRIVERS\\INTRBASE\\DB OPEN\\BLOBS TO CACHE"; INTERBASEBLOBSIZE = "\\DRIVERS\\INTRBASE\\DB OPEN\\BLOB SIZE"; INTERBASEVERSION = "\\DRIVERS\\INTRBASE\\INIT\\VERSION"; INTERBASETYPE = "\\DRIVERS\\INTRBASE\\INIT\\TYPE"; INTERBASEDLL = "\\DRIVERS\\INTRBASE\\INIT\\DLL"; INTERBASEDRIVERFLAGS = "\\DRIVERS\\INTRBASE\\INIT\\DRIVER FLAGS"; INTERBASEDLL32 = "\\DRIVERS\\INTRBASE\\INIT\\DLL32"; INTERBASETRACEMODE = "\\DRIVERS\\INTRBASE\\INIT\\TRACE MODE"; { Oracle Driver Settings... } ORACLEBATCHCOUNT = "\\DRIVERS\\ORACLE\\DB OPEN\\BATCH COUNT"; ORACLEENABLEBCD = "\\DRIVERS\\ORACLE\\DB OPEN\\ENABLE BCD"; ORACLEENABLEINTEGERS = "\\DRIVERS\\ORACLE\\DB OPEN\\ENABLE INTEGERS"; ORACLEENABLESCHEMACACHE = "\\DRIVERS\\ORACLE\\DB OPEN\\ENABLE SCHEMA CACHE"; ORACLELANGDRIVER = "\\DRIVERS\\ORACLE\\DB OPEN\\LANGDRIVER"; ORACLELISTSYNONYMS = "\\DRIVERS\\ORACLE\\DB OPEN\\LIST SYNONYMS"; ORACLEMAXROWS = "\\DRIVERS\\ORACLE\\DB OPEN\\MAX ROWS"; ORACLENETPROTOCOL = "\\DRIVERS\\ORACLE\\DB OPEN\\NET PROTOCOL"; ORACLEOPENMODE = "\\DRIVERS\\ORACLE\\DB OPEN\\OPENMODE"; ORACLEROWSETSIZE = "\\DRIVERS\\ORACLE\\DB OPEN\\ROWSET SIZE"; ORACLESCHEMACACHEDIR = "\\DRIVERS\\ORACLE\\DB OPEN\\SCHEMA CACHE DIR"; ORACLESCHEMACACHESIZE = "\\DRIVERS\\ORACLE\\DB OPEN\\SCHEMA CACHE SIZE"; ORACLESCHEMACACHETIME = "\\DRIVERS\\ORACLE\\DB OPEN\\SCHEMA CACHE TIME"; ORACLESERVERNAME = "\\DRIVERS\\ORACLE\\DB OPEN\\SERVER NAME"; ORACLESQLPASSTHRUMODE = "\\DRIVERS\\ORACLE\\DB OPEN\\SQLPASSTHRU MODE"; ORACLESQLQUERYMODE = "\\DRIVERS\\ORACLE\\DB OPEN\\SQLQRYMODE"; ORACLEUSERNAME = "\\DRIVERS\\ORACLE\\DB OPEN\\USER NAME"; ORACLEDLL = "\\DRIVERS\\ORACLE\\INIT\\DLL"; ORACLEDLL32 = "\\DRIVERS\\ORACLE\\INIT\\DLL32"; ORACLEDRIVERFLAGS = "\\DRIVERS\\ORACLE\\INIT\\DRIVER FLAGS"; ORACLETRACEMODE = "\\DRIVERS\\ORACLE\\INIT\\TRACE MODE"; ORACLETYPE = "\\DRIVERS\\ORACLE\\INIT\\TYPE"; ORACLEVENDORINIT = "\\DRIVERS\\ORACLE\\INIT\\VENDOR INIT"; ORACLEVERSION = "\\DRIVERS\\ORACLE\\INIT\\VERSION"; { MSACCESS Driver Settings... } MSACCEESSLANGDRIVER = "\\DRIVERS\\MSACCESS\\DB OPEN\\LANGDRIVER"; MSACCESSDATABASENAME = "\\DRIVERS\\MSACCESS\\DB OPEN\\DATABASE NAME"; MSACCESSUSERNAME = "\\DRIVERS\\MSACCESS\\DB OPEN\\USER NAME"; MSACCESSOPENMODE = "\\DRIVERS\\MSACCESS\\DB OPEN\\OPEN MODE"; MSACCESSSYSTEMDATABASE = "\\DRIVERS\\MSACCESS\\DB OPEN\\SYSTEMDATABASE"; MSACCESSVERSION = "\\DRIVERS\\MSACCESS\\INIT\\VERSION"; MSACCESSTYPE = "\\DRIVERS\\MSACCESS\\INIT\\TYPE"; MSACCESSDLL32 = "\\DRIVERS\\MSACCESS\\INIT\\DLL32"; MSACCESSDRIVERFLAGS = "\\DRIVERS\\MSACCESS\\INIT\\DRIVER FLAGS"; MSACCESSTRACEMODE = "\\DRIVERS\\MSACCESS\\INIT\\TRACE MODE"; { System Initialization Settings... } AUTOODBC = "\\SYSTEM\\INIT\\AUTO ODBC"; DATAREPOSITORY = "\\SYSTEM\\INIT\\DATA REPOSITORY"; DEFAULTDRIVER = "\\SYSTEM\\INIT\\DEFAULT DRIVER"; LANGDRIVER = "\\SYSTEM\\INIT\\LANGDRIVER"; LOCALSHARE = "\\SYSTEM\\INIT\\LOCAL SHARE"; LOWMEMORYUSAGELIMIT = "\\SYSTEM\\INIT\\LOW MEMORY USAGE LIMIT"; MAXBUFSIZE = "\\SYSTEM\\INIT\\MAXBUFSIZE"; MAXFILEHANDLES = "\\SYSTEM\\INIT\\MAXFILEHANDLES"; MEMSIZE = "\\SYSTEM\\INIT\\MEMSIZE"; MINBUFSIZE = "\\SYSTEM\\INIT\\MINBUFSIZE"; SHAREDMEMLOCATION = "\\SYSTEM\\INIT\\SHAREDMEMLOCATION"; SHAREDMEMSIZE = "\\SYSTEM\\INIT\\SHAREDMEMSIZE"; SQLQRYMODE = "\\SYSTEM\\INIT\\SQLQRYMODE"; SYSFLAGS = "\\SYSTEM\\INIT\\SYSFLAGS"; VERSION = "\\SYSTEM\\INIT\\VERSION"; |
Last Modified: 05-OCT-99