home *** CD-ROM | disk | FTP | other *** search
- Types
-
- Paradox Engine BDE Variable name in this doc
- -----------------------------------------------------------------
- PXCODE DBIResult rslt
- TABLEHANDLE hDBICur tabH
- RECORDHANDLE pBYTE recH
- FIELDNUMBER UINT16 iFld
- LOCKHANDLE UINT32
- RECORDNUMBER UINT32 recNum
- BLOBHANDLE INT16
-
-
- Functions
-
- Paradox Engine BDE
- -----------------------------------------------------------------
- BLANK DbiPutField(tabH, iFld, recH, NULL);
- (Cannot compare Field Data with BLANK in
- IDAPI. Use the value returned from
- DbiGetField in bIsBlank to determine if a
- field is blank.)
-
- ISBANK() Use the blank parameter in
- DbiGetField(tabH, iFld, recH, pDest,
- &bIsBlank);
- or
- DbiVerifyField(tabH, iFld, pSrc, &bIsBlank);
-
- PXBlobClone() Not Supported.
- (Private BLOBs are not supported in IDAPI)
-
- PXBlobClose()
- accept == FALSE DbiFreeBlob(tabH, recH, iFld);
- accept == TRUE Not required in IDAPI. Note that
- DbiFreeBlob(tabH, recH, iFld) needs to be
- called _after_ adding a record containing a
- BLOB to a table.
-
- PXBlobDrop() DbiGetRecord(tabH, dbiNOLOCK, recH, NULL);
- DbiTruncateBlob(tabH, recH, iFld, 0);
- DbiModifyRecord(tabH, recH, FALSE);
-
-
- PXBlobGet() DbiGetBlob(tabH, recH, iFld, iOff, iLen,
- pDest, &iRead);
-
- PXBlobGetSize() DbiGetBlobSize(tabH, recH, iFld, piSize);
-
- PXBlobOpenRead() DbiOpenBlob(tabH, recH, iField,dbiREADONLY);
-
- PXBlobOpenWrite() DbiOpenBlob(tabH, recH, iField,
- dbiREADWRITE);
-
- PXBlobPut() DbiPutBlob(tabH, recH, iFld, iOff, iLen,
- pSrc);
-
- PXBlobQuickGet() DbiGetBlobHeading(tabH, iFld, recH, &iSize);
- (Paradox Tables only.)
-
- PXDateDecode() DbiDateDecode(dateD, piMon, piDay, piYear);
-
- PXDateEncode() DbiDateEncode(iMon, iDay, iYear, pdateD);
-
- PXErrMsg() DbiGetErrorString(iErrorCode, szError);
- or
- DbiGetErrorInfo(&ErrInfo);
- (Must be called imediately after the
- offending function - privides more
- information than DbiGetErrorString.)
-
- PXExit() DbiCloseDatabase(&hDb);
- DbiExit();
-
- PXFldBlank() DbiGetField(tabH, iFld, recH, NULL,
- &bIsBlank);
- or
- DbiVerifyField(tabH, iFld, pSrc, &bIsBlank);
- bIsBlank = TRUE is field is blank.
-
- PXFldHandle() DbiGetFieldDescs(tabH, &fldDesc);
- fldDesc.iFldNum;
-
- PXFldName() DbiGetFieldDescs(tabH, &fldDesc);
- fldDesc.szName;
-
- PXFldType() DbiGetFieldDescs(tabH, &fldDesc);
- fldDesc.iFldType;
- fldDesc.iSubType;
-
- PXGetAlpha() DbiGetField(tabH, iFld, recH,
- (pBYTE)szString, &bIsBlank);
-
- PXGetDate() DbiGetField(tabH, iFld, recH,
- (pBYTE)&Date, &bIsBlank);
-
- PXGetDefaults() DbiOpenCfgInfoList(hCfg, eOpenMode,
- eConfigMode, pszCfgPath,
- &tabH);
-
- PXGetDoub() DbiGetField(tabH, iFld, recH,
- (pBYTE)&Double, &bIsBlank);
-
- PXGetLong() DbiGetField(tabH, iFld, recH,
- (pBYTE)&Long, &bIsBlank);
-
- PXGetShort() DbiGetField(tabH, iFld, recH,
- (pBYTE)&Short, &bIsBlank);
-
- PXInit() Not Supported. See PXWinInit.
-
- PXKeyAdd() DbiAddIndex(hDb, tabH, szTblName, szTblType,
- &IdxDesc);
-
- PXKeyDrop() DbiDeleteIndex(hDb, tabH, szTblName,
- szTblType, NULL, NULL,
- iIndexId);
-
- PXKeyMap() Not Supported.
- (Key Mapping is no longer needed - all
- pertinent information is put in the index
- descriptor - IdxDesc)
-
- PXKeyNFlds() DbiGetIndexSeqNo(tabH, NULL, NULL, 0,
- &seqNo);
- DbiGetIndexDesc(tabH, seqNo, &idxDesc);
- idxDesc.iFldsInKey;
- (Note that Paradox in the only database
- which has the concept of a primary index)
-
- PXKeyQuery() Not Supported.
- (The BDE does not have any function like
- this. You need to call DbiGetIndexDescs()
- and then look for the index you want. Once
- found all the information about that index
- is available to you in the structure.)
-
- PXNetErrUser() DbiErrGetErrorContext(ecUSERNAME,
- szUserName);
-
- PXNetFileLock() DbiAcqPersistTableLock(hDb, (pCHAR)fileName,
- Driver);
-
- PXNetFileUnlock() DbiRelPersistTableLock(hDb, (pCHAR)fileName,
- Driver);
-
- PXNetInit() Not Support. See PXWinInit.
-
- PXNetRecGotoLock() Not Supported.
- (Can be simulated by setting a bookmark on
- the record which is locked and then
- switching to that bookmark:
- DbiSetToBookMark(tabH, pBookMark);)
-
- PXNetRecLock() DbiGetRecord(tabH, dbiWRITELOCK, NULL,
- NULL);
-
- PXNetRecLocked() DbiIsRecordLocked(tabH, edbiLock, piLocks);
-
- PXNetRecUnlock() DbiRelRecordLock(tabH, FALSE);
- or durring the update of the record -
- DbiModifyRecord(tabH, recH, TRUE);
-
- PXNetTblChanged() Need to register a cbTABLECHANGED callback.
- (Paradox only.)
-
- PXNetTblLock() DbiAcqTableLock(tabH, eLockType);
- (Note that only Read and Write locks
- are supported by this function. For a
- FL on a table, open the table with
- the dbiOPENEXCL parameter or use the
- DbiAcqPersistTableLock function.)
-
- PXNetTblRefresh() DbiForceReread(tabH);
-
- PXNetTableUnlock() DbiRelTableLock(tabH, eLockType);
-
- PXNetUserName() DbiGetNetUserName(pzName);
-
- PXPswAdd() DbiAddPassword(szPassword);
- (Paradox tables only.)
-
- PXPswDel() DbiDropPassword(szPassword);
- (Paradox tables only.)
-
- PXPutAlpha() DbiPutField(tabH, iFld, recH,
- (pBYTE)szString);
-
- PXPutBlank() DbiPutField(tabH, iFld, recH, NULL);
-
- PXPutDate() DbiPutField(tabH, iFld, recH,
- (pBYTE)&Date);
-
- PXPutDoub() DbiPutField(tabH, iFld, recH,
- (pBYTE)&Double);
-
- PXPutLong() DbiPutField(tabH, iFld, recH,
- (BYTE)&Long);
-
- PXPutShort() DbiPutField(tabH, iFld, recH,
- (pBYTE)&Short);
-
- PXRawGet() DbiSetProp((hDBIObj)tabH, curXLTMODE,
- xltNONE)
- DbiGetRecord(tabH, NULL, recH, NULL);
-
- PXRawPut() DbiSetProp((hDBIObj)tabH, curXLTMODE,
- xltNONE)
- DbiInsertRecord(tabH, dbiNOLOCK, recH,
- pDest);
-
- PXRecAppend() DbiAppendRecord(tabH, recH);
-
- PXRecBufClose() The application needs to release the memory
- associated with the record buffer. In 'C',
- call: free(recH).
- (Record buffers in IDAPI are owned by the
- application.)
-
- PXRecBufCopy() The application needs to copy the memory
- which is used for the record buffer. In 'C',
- call:
- memcpy(recHDest, recHSource, size).
- (Record buffers in IDAPI are owned by the
- application.)
-
- PXRecBufEmpty() DbiInitRecord(tabH, recH);
-
- PXRecBufOpen() The application needs to allocate memory for
- record buffer. In 'C', call:
- DbiGetCursorProps(tabH, &CurProps);
- recH = (pBYTE)malloc(CurProps.iRecBufSize
- * sizeof(BYTE));
- (Record buffers in IDAPI are owned by the
- application.)
-
- PXRecDelete() DbiDeleteRecord(tabH, NULL);
-
- PXRecFirst() DbiSetToBegin(tabH);
- DbiGetNextRecord(tabH, dbiNOLOCK, NULL,
- NULL);
- (IDAPI has the concept of Beginning of file,
- which is before the first record).
-
- PXRecGet() DbiGetRecord(tabH, dbiNOLOCK, recH, NULL);
-
- PXRecGoto() Not supported by the SQL Drivers.
- Example for use with 'C':
- DBIResult gotoRec(hDBICur tabH,
- UINT32 recNum)
- {
- DBIResult lastError;
- CURProps curProps;
-
- lastError = DbiGetCursorProps(tabH,
- &curProps);
- if (lastError != DBIERR_NONE)
- {
- return lastError;
- }
-
- if (!strcmp(curProps.szTableType,
- szPARADOX))
- {
- lastError = DbiSetToSeqNo(tabH,
- recNum);
- }
- else if (!strcmp(curProps.szTableType,
- szDBASE))
- {
- lastError = DbiSetToRecordNo(tabH,
- recNum);
- }
- else
- {
- lastError = DBIERR_NOTSUPPORTED;
- }
-
- return lastError;
- }
-
- PXRecInsert() DbiInsertRecord(tabH, dbiNOLOCK, recH);
-
- PXRecLast() DbiSetToEnd(tabH);
- DbiGetPriorRecord(tabH, dbiNOLOCK, NULL,
- NULL);
- (IDAPI has the concept of End of File, which
- is after the last record).
-
- PXRecNext() DbiGetNextRecord(tabH, dbiNOLOCK, NULL,
- NULL);
-
- PXRecNFlds() DbiGetCursorProps(tabH, &CurProps);
- lFlds = CurProps.iFields;
-
- PXRecNum() Not supported for SQL Tables.
- Example for use with 'C':
- DBIResult getCurRecNum(hDBICur tabH,
- UINT32 *recNum)
- {
- DBIResult lastError;
- CURProps curProps;
- RECProps recProps;
-
- lastError = DbiGetCursorProps(tabH,
- &curProps);
- if (lastError != DBIERR_NONE)
- {
- return lastError;
- }
-
- if (!strcmp(curProps.szTableType,
- szPARADOX))
- {
- lastError = DbiGetSeqNo(tabH,
- (pUINT32)recNum);
- }
- else if (!strcmp(curProps.szTableType,
- szDBASE))
- {
- lastError = DbiGetRecord(tabH,
- dbiNOLOCK,
- NULL,
- &recProps);
- *recNum = recProps.iPhyRecNum;
- }
- else
- {
- lastError = DBIERR_NOTSUPPORTED;
- }
-
- return lastError;
- }
-
- PXRecPrev() DbiGetPriorRecord(tabH, dbiNOLOCK, NULL,
- NULL);
-
- PXRecUpdate() DbiModifyRecord(tabH, recH, TRUE);
-
- PXSave() DbiForceReread(tabH);
-
- PXSetDefaults() DbiOpenCfgInfoList()
-
- PXSetHWHandler() Not Supported
-
- PXSrchFld() DbiSetToKey(tabH, keySEARCHEQ, FALSE, iFlds
- iLen, pIdxBuf);
-
- PXSrchKey() DbiSwitchToIndex(&tabH, NULL, NULL, 0,
- TRUE);
- DbiSetToKey(tabH, keySEARCHEQ, FALSE, iFlds
- iLen, pIdxBuf);
- (can only search on the currently active
- index)
-
- PXTblAdd() DbiBatchMove(NULL, hSrcCur, NULL, hDestCur,
- batAPPEND, 0, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, TRUE, FALSE,
- NULL, TRUE);
-
- PXTblClose() DbiCloseCursor(&tabH);
-
- PXTblCopy() DbiCopyTable(hDb, TRUE, szSrcName,
- szPARADOX, szDestName);
-
- PXTblCreate() DbiCreateTable(hDb, TRUE, &TblDesc);
-
- PXTblCreateMode() DbiCreateTable(hDb, TRUE, &TblDesc);
- (Use the optional parameters to change the
- level of the table.)
-
- PXTblDecrypt() Only Supported for Paradox Tables
- Example for use with 'C':
- DBIResult decryptTable(hDBIDb hDb,
- const char *tableName)
- {
- CRTblDesc crTblDesc;
- DBIResult lastError;
-
- // Clear the buffer
- memset(&crTblDesc, 0,
- sizeof(CRTblDesc));
-
- // name of the table
- strcpy(crTblDesc.szTblName, tableName);
-
- lastError = DbiDoRestructure(hDb, 1,
- &crTblDesc,
- NULL, NULL,
- NULL,
- FALSE);
-
- return lastError;
- }
-
- PXTblDelete() DbiDeleteTable(hDb, szTblName, szPARADOX);
-
- PXTblEmpty() DbiEmptyTable(hDb, tabH, szTblName,
- szPARADOX);
-
- PXTblEncrypt() (Only Supported for Paradox Tables)
- Example for use with 'C':
- DBIResult encryptTable(hDBIDb hDb,
- const char *tableName,
- const char *password)
- {
- CRTblDesc crTblDesc;
- DBIResult lastError;
-
- // Clear the buffer
- memset(&crTblDesc, 0,
- sizeof(CRTblDesc));
-
- // name of the table
- strcpy(crTblDesc.szTblName, tableName);
- // Master password suplied for the table
- crTblDesc.bProtected = TRUE;
- // Password for the table
- strcpy(crTblDesc.szPassword, password);
-
- lastError = DbiDoRestructure(hDb, 1,
- &crTblDesc,
- NULL, NULL,
- NULL, FALSE);
-
- return lastError;
- }
-
- PXTblExist() Not directly supported. Need to use
- DbiOpenTableList to get a list of available
- tables, and then search that list for the
- table. Example for use with 'C':
- BOOL tableExists(hDBIDb hDb,
- const char *userName,
- const char *tableName,
- const char *tableType)
- {
- BOOL exists = FALSE;
- BOOL isLocal = TRUE;
- hDBICur tabH = 0;
- char *tblName;
- TBLBaseDesc tblDesc;
- CHAR remoteName[DBIMAXNAMELEN+1];
- DBIResult lastError;
-
- if ((!strcmp(tableType, szPARADOX)) ||
- (!strcmp(tableType, szDBASE)) ||
- (!strcmp(tableType, szASCII)))
- {
- tblName = _fstrtok((pCHAR)tableName,
- ".");
- isLocal = TRUE;
- }
- else if ((!strcmp(tableType, "ORACLE"))
- ||
- (!strcmp(tableType, "SYBASE")))
- {
- strcpy(remoteName, userName);
- strcat(remoteName, ".");
- strcat(remoteName, tableName);
- tblName = (pCHAR)tableName;
- isLocal = FALSE;
- }
- else
- {
- strcpy(remoteName, tableName);
- tblName = (pCHAR)tableName;
- isLocal = FALSE;
- }
-
- if (tblName == NULL)
- {
- lastError = DBIERR_INVALIDTABLENAME;
- return FALSE;
- }
-
- lastError = DbiOpenTableList(hDb, FALSE,
- TRUE,"*.*",
- &tabH);
- if (lastError != DBIERR_NONE)
- {
- return FALSE;
- }
-
- lastError = DbiSetToBegin(tabH);
- if (lastError != DBIERR_NONE)
- {
- return FALSE;
- }
-
- while ((DbiGetNextRecord(tabH,dbiNOLOCK,
- (pBYTE)&tblDesc,
- NULL))
- == DBIERR_NONE)
- {
- if (!stricmp(tblDesc.szName,
- tblName))
- {
- // Check if the types match
- if (strcmp(tblDesc.szType,
- tableName) &&
- (isLocal))
- {
- // keep searching it the
- // table is of the wrong
- // type
- continue;
- }
- lastError = DBIERR_NONE;
- DbiCloseCursor(&tabH);
- return TRUE;
- }
- }
-
- if (tabH)
- {
- DbiCloseCursor(&tabH);
- }
-
- lastError = DBIERR_NOSUCHTABLE;
-
- return exists;
- }
-
- PXTblMaxSize() DbiCreateTable(hDb, TRUE, &TblDesc);
- (This is done using the optional parameters
- in the table descriptor)
-
- PXTblName() DbiGetCursorProps(tabH, &CurProps);
- strcpy(szTblName, CurProps.szName);
-
- PXTblNRecs() DbiGetRecordCount(tabH, &iRecCount);
- (This function returns an approximation of
- the number of records in the table.)
-
- PXTblOpen() DbiOpenTable(hDb, szTblName, szPARADOX,
- NULL, NULL, indexID,
- dbiREADWRITE, dbiOPENSHARED,
- xltFIELD, TRUE, NULL, &tabH);
-
- PXTblProtected() Not directly supported. For local tables,
- need to call DbiOpenTableList and get the
- information for that table.
- Example for use with 'C':
- BOOL isProtected(hDBIDb hDb,
- const char *tableName,
- const char *tableType)
- {
- BOOL protect = FALSE;
- hDBICur tabH = 0;
- char *tblName;
- TBLFullDesc tblDesc;
- DBIResult lastError;
-
- // Different methodology required for
- // local and remote tables
- if ((!strcmp(tableType, szPARADOX)) ||
- (!strcmp(tableType, szDBASE)) ||
- (!strcmp(tableType, szASCII)))
- {
- tblName = _fstrtok((pCHAR)tableName,
- ".");
- if (tblName == NULL)
- {
- lastError =
- DBIERR_INVALIDTABLENAME;
- return FALSE;
- }
-
- lastError = DbiOpenTableList(hDb,
- TRUE, TRUE,
- "*.*", &tabH);
- if (lastError != DBIERR_NONE)
- {
- return FALSE;
- }
-
- lastError = DbiSetToBegin(tabH);
- if (lastError != DBIERR_NONE)
- {
- return FALSE;
- }
-
- while ((DbiGetNextRecord(tabH,
- dbiNOLOCK,
- (pBYTE)&tblDesc,
- NULL))
- == DBIERR_NONE)
- {
- if (!stricmp(
- tblDesc.tblBase.szName,
- tblName))
- {
- if (stricmp(
- tblDesc.tblBase.szType,
- tableType))
- {
- // Keep searching if the
- // type doesn't match
- continue;
- }
- if (
- tblDesc.tblExt.bProtected
- == TRUE)
- {
- // Table is protected
- lastError = DBIERR_NONE;
- DbiCloseCursor(&tabH);
- return TRUE;
- }
- else
- {
- lastError = DBIERR_NONE;
- DbiCloseCursor(&tabH);
- return FALSE;
- }
- }
- }
-
- if (tabH)
- {
- DbiCloseCursor(&tabH);
- }
-
- lastError = DBIERR_NOSUCHTABLE;
- }
- else
- {
- lastError = DbiOpenTable(hDb,
- (pCHAR)tableName,
- (pCHAR)tableType,
- NULL, NULL, NULL,
- dbiREADONLY,
- dbiOPENSHARED,
- xltNONE, FALSE,
- NULL, &tabH);
- if (lastError == DBIERR_NONE)
- {
- DbiCloseCursor(&tabH);
- protect = FALSE;
- return protect;
- }
- else if (lastError ==
- DBIERR_INVALIDPASSWORD)
- {
- lastError = DBIERR_NONE;
- protect = TRUE;
- return protect;
- }
- }
-
- return protect;
- }
-
-
- PXTblRename() DbiRenameTable(hDb, szOldName, szTableType,
- szNewName);
-
- PXTblUpgrade() DbiDoRestructure(hDb, 1, pTblDesc, pSaveAs,
- NULL, NULL, FALSE);
- (Need to use the Optional Parameters to set
- the level of the table. Local tables only.)
-
- PXWinInit() DbiInit(NULL);
- DbiOpenDatabase(NULL, NULL, dbiREADWRITE,
- dbiOPENSHARED, NULL, 0,
- NULL, NULL, &hDb);
-