Board index » off-topic » ORA CLOB
stefan rado
Delphi Developer |
stefan rado
Delphi Developer |
ORA CLOB2004-07-22 07:15:35 PM off-topic13 the BDE duplicates the 8196st char from each data i will display or export to file from a clob field in Oracle 9. does anybody have an idea how i can handle this problem? |
Mike Shkolnik
Delphi Developer |
2004-07-22 07:21:54 PM
Re:ORA CLOB
BDE doesn't support the Oracle 9i
Use another database engine (DOA, ADO, etc) instead "stefan rado" < XXXX@XXXXX.COM >wrote in message Quote
|
JMG
Delphi Developer |
2004-07-27 05:07:30 PM
Re:ORA CLOB
ADO mdac 2.7 does'nt support CLOB oracle field (with MS driver)
The Oracle driver (ORAOLEDB) supports it but is very limited in performance and transactions speed. There is a .net ADO update you can find in Microsoft site : support.microsoft.com/default.aspx support.microsoft.com/default.aspx Jean-Michel "Mike Shkolnik" < XXXX@XXXXX.COM >a écrit dans le message de QuoteBDE doesn't support the Oracle 9i {smallsort} |
Swapna Apte
Delphi Developer |
2004-09-21 07:49:16 PM
Re:ORA CLOB
Hi Stefan,
We are using Oracle 9i with our multi tier application thru BDE and have faced and solved many problems relating to the same. And (Touchwood) we're going strong so far. So dont let the negative posts dishearten u ;-). Below is a fix we found and made, hope it helps you too. Regards, Swapna. ---------------------------------- In unit DBTables.pas follow the comment tag //ChangedCode ---------------------------------- //Add following 2 methods function DbiGetBlobSize (hCursor: hDBICur; pRecBuf: Pointer; iField: Word; var iSize: Longint; aDataSet : TBDEDataSet): DBIResult; var db_type: DBINAME; prop_len: Word; begin Result := bde.DbiGetBlobSize(hCursor, pRecBuf, iField, iSize); if Result = DBIERR_NONE then begin Check(DbiGetProp(hDBIObj(hCursor), dbDATABASETYPE, @db_type, SizeOf(db_type), prop_len)); if ((aDataSet is TTable) or ((aDataSet is TQuery) and (aDataSet as TQuery).RequestLive)) and (StrComp(PChar(@db_type), 'ORACLE') = 0) and (iSize>$2000) then // ORACLE driver repeats character at 2000hex Dec(iSize); end; end; function DbiGetBlob(hCursor: hDBICur; pRecBuf: Pointer; iField: Word; iOffSet: Longint; iLen: Longint; pDest: Pointer; var iRead: Longint; aDataSet : TBDEDataSet): DBIResult; var db_type: DBINAME; prop_len: Word; begin Check(DbiGetProp(hDBIObj(hCursor), dbDATABASETYPE, @db_type, SizeOf(db_type), prop_len)); if ((aDataSet is TTable) or ((aDataSet is TQuery) and (aDataSet as TQuery).RequestLive)) and (StrComp(PChar(@db_type), 'ORACLE') = 0) and (iOffset + iLen> $2000) then begin // ORACLE driver repeats character at 2000hex if iOffset>$2000 then // take extra character into account Result := bde.DbiGetBlob(hCursor, pRecBuf, iField, iOffset + 1, iLen, pDest, iRead) else begin // read upto $2000 Result := bde.DbiGetBlob(hCursor, pRecBuf, iField, iOffset, $2000 - iOffset, pDest, iRead); if Result = DBIERR_NONE then begin // skip repeated char and read the rest of the field Result := bde.DbiGetBlob(hCursor, pRecBuf, iField, $2001, iLen - iRead, PChar(pDest) + iRead, iRead); iRead := iRead + $2000 - iOffset; end; end; end else Result := bde.DbiGetBlob(hCursor, pRecBuf, iField, iOffset, iLen, pDest, iRead); end; ---------------------------------- //Then in method TBDEDataSet.GetBlobFieldData do the following function TBDEDataSet.GetBlobFieldData(FieldNo: Integer; var Buffer: TBlobByteData): Integer; var RecBuf: PChar; Status: DBIResult; DoCheck: Boolean; bIsOraBlob : Boolean; //ChangedCode begin Result := 0; DoCheck := BlockReadSize = 0; if BlockReadSize>0 then RecBuf := FBlockReadBuf + (FBlockBufOfs * FRecordSize) else if not GetActiveRecBuf(RecBuf) then Exit; Status := DbiOpenBlob(FHandle, RecBuf, FieldNo, dbiReadOnly); if Status <>DBIERR_NONE then Exit; try //ChangedCode Start bIsOraBlob := (Fields[FieldNo-1] is TBlobField) and (TBlobField( Fields[FieldNo-1]).BlobType in [ftOraBlob,ftOraClob]); //Status := DbiGetBlobSize(FHandle, RecBuf, FieldNo, Result); if bIsOraBlob then Status := DbiGetBlobSize(FHandle, RecBuf, FieldNo, Result, Self) else Status := bde.DbiGetBlobSize(FHandle, RecBuf, FieldNo, Result); //ChangedCode End if (Status <>DBIERR_NONE) or (Result = 0) then Exit; if Length(Buffer) <= Result then SetLength(Buffer, Result + Result div 4); //ChangedCode Start //Status := DbiGetBlob(FHandle, RecBuf, FieldNo, 0, Result, Buffer, Result); if bIsOraBlob then Status := DbiGetBlob(FHandle, RecBuf, FieldNo, 0, Result, Buffer, Result, Self) else Status := bde.DbiGetBlob(FHandle, RecBuf, FieldNo, 0, Result, Buffer, Result); //ChangedCode End finally if Status <>DBIERR_NONE then Result := 0; DbiFreeBlob(FHandle, RecBuf, FieldNo); if DoCheck then Check(Status) end; end; stefan rado wrote: Quotethe BDE duplicates the 8196st char from each data i will display or export to file from a clob field in Oracle 9. |