Главная страница | назад





Article #10347: Programmatically Changing the IDAPI.cfg

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 = "&#092&#092DRIVERS&#092&#092PARADOX&#092&#092INIT&#092\NET DIR";

PARADOXVERSION = "&#092&#092DRIVERS&#092&#092PARADOX&#092&#092INIT&#092\VERSION";

PARADOXTYPE = "&#092&#092DRIVERS&#092&#092PARADOX&#092&#092INIT&#092\TYPE";

PARADOXLANGDRIVER = "&#092&#092DRIVERS&#092&#092PARADOX&#092&#092INIT&#092\LANGDRIVER";

PARADOXLEVEL = "&#092&#092DRIVERS&#092&#092PARADOX&#092&#092TABLE CREATE&#092\LEVEL";

PARADOXBLOCKSIZE = "&#092&#092DRIVERS&#092&#092PARADOX&#092&#092TABLE CREATE&#092\BLOCK SIZE";

PARADOXFILLFACTOR = "&#092&#092DRIVERS&#092&#092PARADOX&#092&#092TABLE CREATE&#092\FILL FACTOR";

PARADOXSTRICTINTEGRITY = "&#092&#092DRIVERS&#092&#092PARADOX&#092&#092TABLE CREATE&#092\STRICTINTEGRITY";

{ dBASE Driver Settings... }

DBASEVERSION = "&#092&#092DRIVERS&#092&#092DBASE&#092&#092INIT&#092\VERSION";

DBASETYPE = "&#092&#092DRIVERS&#092&#092DBASE&#092&#092INIT&#092\TYPE";

DBASELANGDRIVER = "&#092&#092DRIVERS&#092&#092DBASE&#092&#092INIT&#092\LANGDRIVER";

DBASELEVEL = "&#092&#092DRIVERS&#092&#092DBASE&#092&#092TABLE CREATE&#092\LEVEL";

DBASEMDXBLOCKSIZE = "&#092&#092DRIVERS&#092&#092DBASE&#092&#092TABLE CREATE&#092\MDX BLOCK SIZE";

DBASEMEMOFILEBLOCKSIZE = "&#092&#092DRIVERS&#092&#092DBASE&#092&#092TABLE CREATE&#092\MEMO FILE BLOC SIZE";

{ InterBase Driver Settings... }

INTERBASESERVERNAME = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\SERVER NAME";

INTERBASEUSERNAME = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\USER NAME";

INTERBASEOPENMODE = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\OPEN MODE";

INTERBASESCHEMACACHESIZE = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\SCHEMA CACHE SIZE";

INTERBASELANGDRIVER = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\LANGDRIVER";

INTERBASESQLQRYMODE = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\SQLQRYMODE";

INTERBASESQLPASSTHRUMODE = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\SQLPASSTHRU MODE";

INTERBASESCHEMACACHETIME = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\SCHEMS CACHE TIME";

INTERBASEMAXROWS = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\MAX ROWS";

INTERBASEBATCHCOUNT = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\BATCH COUNT";

INTERBASEENABLESCHEMACACHE = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\ENABLE SCHEMA CACHE";

INTERBASEENABLEBCD = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\ENABLE BCD";

INTERBASEBLOBSTOCACHE = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\BLOBS TO CACHE";

INTERBASEBLOBSIZE = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092DB OPEN&#092\BLOB SIZE";

INTERBASEVERSION = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092INIT&#092\VERSION";

INTERBASETYPE = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092INIT&#092\TYPE";

INTERBASEDLL = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092INIT&#092\DLL";

INTERBASEDRIVERFLAGS = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092INIT&#092\DRIVER FLAGS";

INTERBASEDLL32 = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092INIT&#092\DLL32";

INTERBASETRACEMODE = "&#092&#092DRIVERS&#092&#092INTRBASE&#092&#092INIT&#092\TRACE MODE";

{ Oracle Driver Settings... }

ORACLEBATCHCOUNT = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\BATCH COUNT";

ORACLEENABLEBCD = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\ENABLE BCD";

ORACLEENABLEINTEGERS = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\ENABLE INTEGERS";

ORACLEENABLESCHEMACACHE = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\ENABLE SCHEMA CACHE";

ORACLELANGDRIVER = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\LANGDRIVER";

ORACLELISTSYNONYMS = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\LIST SYNONYMS";

ORACLEMAXROWS = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\MAX ROWS";

ORACLENETPROTOCOL = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\NET PROTOCOL";

ORACLEOPENMODE = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\OPENMODE";

ORACLEROWSETSIZE = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\ROWSET SIZE";

ORACLESCHEMACACHEDIR = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\SCHEMA CACHE DIR";

ORACLESCHEMACACHESIZE = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\SCHEMA CACHE SIZE";

ORACLESCHEMACACHETIME = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\SCHEMA CACHE TIME";

ORACLESERVERNAME = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\SERVER NAME";

ORACLESQLPASSTHRUMODE = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\SQLPASSTHRU MODE";

ORACLESQLQUERYMODE = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\SQLQRYMODE";

ORACLEUSERNAME = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092DB OPEN&#092\USER NAME";

ORACLEDLL = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092INIT&#092\DLL";

ORACLEDLL32 = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092INIT&#092\DLL32";

ORACLEDRIVERFLAGS = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092INIT&#092\DRIVER FLAGS";

ORACLETRACEMODE = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092INIT&#092\TRACE MODE";

ORACLETYPE = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092INIT&#092\TYPE";

ORACLEVENDORINIT = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092INIT&#092\VENDOR INIT";

ORACLEVERSION = "&#092&#092DRIVERS&#092&#092ORACLE&#092&#092INIT&#092\VERSION";

{ MSACCESS Driver Settings... }

MSACCEESSLANGDRIVER = "&#092&#092DRIVERS&#092&#092MSACCESS&#092&#092DB OPEN&#092\LANGDRIVER";

MSACCESSDATABASENAME = "&#092&#092DRIVERS&#092&#092MSACCESS&#092&#092DB OPEN&#092\DATABASE NAME";

MSACCESSUSERNAME = "&#092&#092DRIVERS&#092&#092MSACCESS&#092&#092DB OPEN&#092\USER NAME";

MSACCESSOPENMODE = "&#092&#092DRIVERS&#092&#092MSACCESS&#092&#092DB OPEN&#092\OPEN MODE";

MSACCESSSYSTEMDATABASE = "&#092&#092DRIVERS&#092&#092MSACCESS&#092&#092DB OPEN&#092\SYSTEMDATABASE";

MSACCESSVERSION = "&#092&#092DRIVERS&#092&#092MSACCESS&#092&#092INIT&#092\VERSION";

MSACCESSTYPE = "&#092&#092DRIVERS&#092&#092MSACCESS&#092&#092INIT&#092\TYPE";

MSACCESSDLL32 = "&#092&#092DRIVERS&#092&#092MSACCESS&#092&#092INIT&#092\DLL32";

MSACCESSDRIVERFLAGS = "&#092&#092DRIVERS&#092&#092MSACCESS&#092&#092INIT&#092\DRIVER FLAGS";

MSACCESSTRACEMODE = "&#092&#092DRIVERS&#092&#092MSACCESS&#092&#092INIT&#092\TRACE MODE";

{ System Initialization Settings... }

AUTOODBC = "&#092&#092SYSTEM&#092&#092INIT&#092\AUTO ODBC";

DATAREPOSITORY = "&#092&#092SYSTEM&#092&#092INIT&#092\DATA REPOSITORY";

DEFAULTDRIVER = "&#092&#092SYSTEM&#092&#092INIT&#092\DEFAULT DRIVER";

LANGDRIVER = "&#092&#092SYSTEM&#092&#092INIT&#092\LANGDRIVER";

LOCALSHARE = "&#092&#092SYSTEM&#092&#092INIT&#092\LOCAL SHARE";

LOWMEMORYUSAGELIMIT = "&#092&#092SYSTEM&#092&#092INIT&#092\LOW MEMORY USAGE LIMIT";

MAXBUFSIZE = "&#092&#092SYSTEM&#092&#092INIT&#092\MAXBUFSIZE";

MAXFILEHANDLES = "&#092&#092SYSTEM&#092&#092INIT&#092\MAXFILEHANDLES";

MEMSIZE = "&#092&#092SYSTEM&#092&#092INIT&#092\MEMSIZE"; MINBUFSIZE = "&#092&#092SYSTEM&#092&#092INIT&#092\MINBUFSIZE";

SHAREDMEMLOCATION = "&#092&#092SYSTEM&#092&#092INIT&#092\SHAREDMEMLOCATION";

SHAREDMEMSIZE = "&#092&#092SYSTEM&#092&#092INIT&#092\SHAREDMEMSIZE";

SQLQRYMODE = "&#092&#092SYSTEM&#092&#092INIT&#092\SQLQRYMODE"; SYSFLAGS = "&#092&#092SYSTEM&#092&#092INIT&#092\SYSFLAGS";

VERSION = "&#092&#092SYSTEM&#092&#092INIT&#092\VERSION";

Last Modified: 05-OCT-99